Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Merging two select queries

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-09-08 : 20:41:38
Steve writes "I have two select queries. They each return the same number of rows and the contents of each row is the same apart from the last column. In each query, the last column is an aggregate and the where clauses are sufficiently different to make using a join appear inplausible.

What I would ideally like to do is 'merge' the 2 queries so that the resulting row set contains the common columns plus the last columns from each of the original queries.

e.g.

Query 1: select a,b,c,d
Query 2: select a,b,c,e

d and e are aggregates.

'merged' rowset contains a,b,c,d,e"
   

- Advertisement -