MIDRANGE dot COM Mailing List Archive



MIDRANGE-L » February 2013

Here's one for the SQL experts



Couple of other ways to write the same query:

WITH mycte AS
(
SELECT account_id, MAX( date_of_call ) mydate
FROM callrptview
GROUP BY account_id
)
SELECT mycte.account_id, mycte.mydate ,
acctview.other-columns_from_acctview
FROM mycte
JOIN acctview USING ( account_id );


SELECT account_id,
SELECT MAX( date_of_call ) FROM callrptview
WHERE acctview.account_id = callrptview.account_id,
other_columns_from_acctview
FROM acctview
WHERE account_id EXISTS IN ( SELECT DISTINCT account_id FROM callrptview )
;





Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2013 by MIDRANGE dot COM and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact