f***@gmail.com
2015-02-09 22:10:31 UTC
SELECT Subgroups.SubgroupID, DateTime, PtVar, SpecialFlags, SUM(DataValues.Value) AS [Value]
From Subgroups, DataValues
WHERE Subgroups.SubgroupID >= 4343
AND Subgroups.CharID = 309
AND Subgroups.SubgroupID = DataValues.SubgroupID
AND DataValues.SampleNumber IN (SELECT DefectID FROM DefectDescriptions WHERE Type = 95 )
GROUP BY Subgroups.SubgroupID, DateTime, PtVar, SpecialFlags
DataValues has 3 columns:
DataValues(SubgroupID, SampleNumber, Value)
No record is entered for a Value of zero to save space since 90% will be zero.
However, I need the query to return a record for every Subgroups record with and have "SUM(DataValues.Value) = 0" for those records, even though no matching records are found to SUM.
From Subgroups, DataValues
WHERE Subgroups.SubgroupID >= 4343
AND Subgroups.CharID = 309
AND Subgroups.SubgroupID = DataValues.SubgroupID
AND DataValues.SampleNumber IN (SELECT DefectID FROM DefectDescriptions WHERE Type = 95 )
GROUP BY Subgroups.SubgroupID, DateTime, PtVar, SpecialFlags
DataValues has 3 columns:
DataValues(SubgroupID, SampleNumber, Value)
No record is entered for a Value of zero to save space since 90% will be zero.
However, I need the query to return a record for every Subgroups record with and have "SUM(DataValues.Value) = 0" for those records, even though no matching records are found to SUM.