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

Home -> Community -> Usenet -> c.d.o.misc -> Outer Joins with standard Oracle functions?

Outer Joins with standard Oracle functions?

From: John <Nothanks_at_noaddress.com>
Date: Thu, 22 Jan 2004 12:04:02 +0000 (UTC)
Message-ID: <Xns94787AF064DNothanksnoaddresscom@127.0.0.1>


I'm trying to produce a query that will give me a count of records for each month for the past 12 months, defaulting to 0 if there are no records.

I have a subquery to produce the month beginnings (table not possible atm). The records in the table I'm counting have a full date/time.

My query is...  

select company,monthbeginning,count(*)
from mytable a,
monthbeginningssubquery b
where b.date=to_date(to_char(a.thedate,'YYYYMM'),'YYYYMM')(+) group by company,monthbeginning

Unfortunately the outer join isnt accepted by oracle, because it's on a to_date.

Any suggestions? I dont have permissions to write a package/function to handle this, have to be pure sql. This is Oracle 8.1.7.latest STD ed. If there's a better way to do this kinda thing I'm all ears!

Thanks
J Received on Thu Jan 22 2004 - 06:04:02 CST

Original text of this message

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