|
Posted by Will Chamberlain on 11/22/05 22:02
I am working on queries for a SQL database. I have much experience with
Access and am trying to ween myself off of it. The query I am working
on now is supposed to return a set of data like the following:
LatestVersion(Ver)/VersionUpdate(Update)/Location(SheetNumber)
A/aa1/3
This works fine except for some of the products in the database don't
have these values attributed to them. I am using the following SQL
query:
SELECT Max(COALESCE(Sheet.Ver, 'NONE')) AS MaxOfVer,
Max(COALESCE(Update.Update, 0)) AS MaxOfUpdate, Sheet.SheetNumber FROM
Drawings INNER JOIN (Update INNER JOIN
Sheet ON Update.RecordID = Sheet.RecordID) ON Drawings.Drawing =
Sheet.Drawing WHERE (Sheet.Drawing = 'XXXXX') AND
(Sheet.SheetType = 'SH') GROUP BY Sheet.Drawing, Sheet.SheetType,
Sheet.SheetNumber
How can I edit this string to return either all 3 of the fields I need,
or return all of 3 of the fields with value = NONE if there are no
results. Is it possible to wrap a COALESCE around the whole query
string?
*** Sent via Developersdex http://www.developersdex.com ***
[Back to original message]
|