Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Newbie: combining two selects
On Mon, 31 Jul 2006 14:12:10 -0700, Martin T. wrote:
What I mean by combine is the first sql statement produces 2 columns lets call them S and C1 and the second statement produces 2 columns called S and C2. I want to combine the two selects so that the produce 3 columns C, C1 and C2. It seems that you should be able to join the sql statements as you would two oracle tables.
> tuxfan wrote:
>> 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
![]() |
![]() |