I have a problem in getting the correct data...
I have two tables, tblbuilding and tbldata.
Here's my tblbuilding:
Here's my tbldata:
my query:
My fldWeek here is "Week 3":
SELECT tblbuilding.fldBldgName
,tblbuilding.fldNetname
,MAX(tbldata.fldDuration) AS fldDuration
,tbldata.fldWeek
,tbldata.fldYear
FROM tblbuilding AS tblbuilding_1
LEFT OUTER JOIN tbldata ON tblbuilding_1.fldBldgName = tbldata.fldBldgName
CROSS JOIN tblbuilding
WHERE (tblbuilding.fldNetname = 'LRT - 2')
AND (tbldata.fldWeek = 'Week 3' OR tbldata.fldWeek IS NULL)
AND (tbldata.fldYear = '2013' OR tbldata.fldYear IS NULL)
GROUP BY tbldata.fldWeek
,tblbuilding.fldBldgName
,tblbuilding.fldNetname
,tbldata.fldYear
ORDER BY tblbuilding.fldBldgName
The result of the query above is:
Which is correct....
but when I changed the fldWeek to "Week 2"
the result is:
The correct result should be...."assuming that I have only two NOT NULL in WEEK 2"
Thanks....