Posted by Anith Sen on 11/07/06 17:14
There are different ways you can do this. One option is to use a correlated
subquery as an additional SQL predicate in the WHERE clause like:
....
WHERE a.location_id = b.location_id
AND b.meterno IS NOT NULL
AND b.meterno = c.meterno
AND a.location_id = d.location_id
AND d.creation_date = ( SELECT MAX( d2.creation_date )
FROM cisdata.Account_Master d2
WHERE a.location_id = d2.location_id )
ORDER BY ...
--
Anith
[Back to original message]
|