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

Home -> Community -> Usenet -> c.d.o.server -> Re: Counting from several tables

Re: Counting from several tables

From: Keith C. Jakobs, MCP <elohir_at_hotmail.com>
Date: Tue, 04 Jun 2002 00:19:01 GMT
Message-ID: <UHTK8.16141$Ti3.272499998@newssvr14.news.prodigy.com>


Hi Jim,

Unfortunately, that only gives me two columns, with each date listed three times, and the second column is labeled "Table1"

But thanks for the idea... I may still be able to use it....

Keith C. Jakobs, MCP
elohir_at_Hotmail.com

"Jim Kennedy" <kennedy-family_at_attbi.com> wrote in message news:VwTK8.53451$0A2.41592_at_rwcrnsc54...
> union would do it.
> ( SELECT TO_CHAR(logdate, 'MMDDYY') AS "Date", count(*) AS "Table1",
> FROM table1
> GROUP BY "Date")
> union
> ( SELECT TO_CHAR(logdate, 'MMDDYY') AS "Date", count(*) AS "Table2"
> FROM table2
> GROUP BY "Date")
> union
> ( SELECT TO_CHAR(logdate, 'MMDDYY') AS "Date", count(*) AS "Table3"
> FROM table3
> GROUP BY "Date")
>
> You may have to muck with it a bit and do
>
> ( SELECT TO_CHAR(logdate, 'MMDDYY') AS "Date", count(*) AS "Table1",
> FROM table1)
> union
> ( SELECT TO_CHAR(logdate, 'MMDDYY') AS "Date", count(*) AS "Table2"
> FROM table2)
> union
> ( SELECT TO_CHAR(logdate, 'MMDDYY') AS "Date", count(*) AS "Table3"
> FROM table3 ) GROUP BY "Date"
>
> Jim
>
>
>
>
> "Keith C. Jakobs, MCP" <elohir_at_hotmail.com> wrote in message
> news:%kTK8.16136$153.271725735_at_newssvr14.news.prodigy.com...
> > Greetings:
> >
> > I am trying to make a SQL script that will tell me the the number of
> records
> > across several tables, listed by date.
> >
> > I would like my row data to show a range of dates, and the count of
> records
> > for each table as my columns, though I will transpose row and columns if
> > necessary (Can I use row data for column headings)?
> >
> > I know how to format my date comparisons, and I can do this script
> perfectly
> > for one table using the script below, but I have no idea how to make one
> > script, that will tally the count of all tables, in one output table.
> >
> > SELECT TO_CHAR(logdate, 'MMDDYY') AS "Date", count(*) AS "Table1"
> > FROM table1
> > GROUP BY "Date";
> >
> > I need the counts of Table2, Table3, etc. to also show up in this table.

> >
> > Can anyone help?
> >
> > Thanks in advance,
> >
> > Keith C. Jakobs, MCP
> > elohir_at_hotmail.com
> >
> >
> >
>
>
Received on Mon Jun 03 2002 - 19:19:01 CDT

Original text of this message

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