CREATE TABLE IF NOT EXISTS `tblflash` (
`FID` int(11) NOT NULL AUTO_INCREMENT,
`fname` text COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`FID`)
)
CREATE TABLE IF NOT EXISTS `tblcount` (
`ID` int(50) NOT NULL AUTO_INCREMENT,
`SID` int(50) NOT NULL,
`FID` int(11) NOT NULL,
`sDateTime` datetime NOT NULL,
`elaspedTime` int(11) NOT NULL,
PRIMARY KEY (`ID`)
)
$sqldate1 =
"SELECT distinct tblflash.FID, tblflash.fname, IFNULL(sum(tblcount.elaspedTime),0)
FROM tblflash
left outer JOIN tblcount
ON tblflash.FID = tblcount.FID
WHERE tblcount.SID='".$_SESSION['SID']."'
ORDER BY tblflash.FID";
假设 tblflash 中有 10 行,tblcount 中有 10 行和 5 行。显示的记录仅显示 5 行。我想显示所有没有重复的 fname,如果 null 设置为 0。
怎么了?