Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: count(*) = 0 and I still need the row
Hi All,
Thanks to William to pointing out a missed outer join, this was the root of all my problems. The final version is: SELECT hp.URL, count(pv.HTML_PAGE_ID) FROM PAGE_VIEWS pv, HTML_PAGE hp WHERE pv.HTML_PAGE_ID(+) = hp.PAGE_ID AND pv.VIEW_DATE(+) > add_months(SYSDATE, -1) GROUP BY hp.URL The nvl in the count line is not needed as count will return 0 if there are no rows in PAGE_VIEWS. I often think this list does more of my job than I do. :) Thanks to all.
-- Dave Morgan Senior Database Administrator Internet Barter Inc. www.bartertrust.comReceived on Fri Nov 17 2000 - 11:15:26 CST