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 -> Re: Newbie: combining two selects

Re: Newbie: combining two selects

From: tuxfan <blank_at_mail.box>
Date: Tue, 01 Aug 2006 16:06:33 -0400
Message-Id: <pan.2006.08.01.20.06.31.978864@mail.box>


On Tue, 01 Aug 2006 06:43:36 +0200, Michel Cadot wrote:

Thanks, that was exactly what I was looking for.

>
> "tuxfan" <blank_at_mail.box> a écrit dans le message de news:
> pan.2006.07.31.20.00.55.948654_at_mail.box...
> |I am trying to combine the following two SQL statements into
> | one select statement. The first column in both statements are the same.
> | It looks like I need a nested statement, but I don't know how to do
> | that.
> |
> |
> | SELECT node_data.server, COUNT ( node_data.node_name ) FROM node_data,
> | account
> | WHERE node_data.node_name = account.node_name AND acct_number = '7777'
> | GROUP BY node_data.server
> |
> | SELECT node_data.server, COUNT ( node_data.node_name ) FROM node_data,
> | account
> | WHERE node_data.node_name = account.node_name AND acct_number = '7777'
> | AND lastacct < 2
> | GROUP BY node_data.server
> |
> |
> SELECT node_data.server, COUNT ( node_data.node_name ),
> COUNT(DECODE(SIGN(2-lastacct),-1,1))
> FROM node_data, account
> WHERE node_data.node_name = account.node_name AND acct_number = '7777'
> GROUP BY node_data.server
> /
>
> Regards
> Michel Cadot
Received on Tue Aug 01 2006 - 15:06:33 CDT

Original text of this message

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