Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: count(*) = 0 and I still need the row
Since you added another condition related to the outer joined table, it also must reflect the outer join:
AND pv.VIEW_DATE (+) > add_months(SYSDATE, -1);
Good luck.
-----Original Message-----
From: Dave Morgan [SMTP:dmorgan_at_bartertrust.com] Sent: Thursday, November 16, 2000 2:10 PM To: Multiple recipients of list ORACLE-L Subject: count(*) = 0 and I still need the row Hi All, Thanks to Javier, Ron, William and Deepak for their efforts I have not tried Ron's solution of pre-setting the variable yet, thats next. I have tried outer joins: SELECT hp.URL, nvl(count(pv.HTML_PAGE_ID),0) FROM PAGE_VIEWS pv, HTMP_PAGE hp WHERE hp.PAGE_ID = pv.HTML_PAGE_ID(+) GROUP BY hp.URL Returns The HideAway 1 The Townsend 0 Tony's Place 0 Yet Another 0 available 0 creepy condo's 2 slumpers 3 twomonthsago 2 Add in the date restriction: SELECT hp.URL, nvl(count(pv.HTML_PAGE_ID),0) FROM PAGE_VIEWS pv, HTMP_PAGE hp WHERE hp.PAGE_ID = pv.HTML_PAGE_ID (+) AND pv.VIEW_DATE > add_months(SYSDATE, -1); GROUP BY hp.URL Returns The HideAway 1 creepy condo's 2 slumpers 3
And people believe I know what I'm doing????
It does process the row "twomonthsago" semi-properly as those pageviews are more than 1 month ago. (Yes the data was created to be meaningful) I say semi-properly because it should display
twomonthsago 0
Anyone know why the the date test alters the outer join results?
TIA
Dave
--
Dave Morgan
Senior Database Administrator
Internet Barter Inc.
www.bartertrust.com
408-982-8774
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Dave Morgan
INET: dmorgan_at_bartertrust.com
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists --------------------------------------------------------------------To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may Received on Thu Nov 16 2000 - 14:53:53 CST