Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: count(*) = 0 and I still need the row

RE: count(*) = 0 and I still need the row

From: Dave Morgan <dmorgan_at_bartertrust.com>
Date: Fri, 17 Nov 2000 09:15:26 -0800
Message-Id: <10683.122386@fatcity.com>


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         
-- 
Dave Morgan
Senior Database Administrator
Internet Barter Inc.
www.bartertrust.com
Received on Fri Nov 17 2000 - 11:15:26 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US