Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2 Selects running at once on the same data

Status
Not open for further replies.

edmana

Programmer
Joined
Jan 23, 2008
Messages
114
Location
US
I have a SQL query that uses derived tables (thanks George!). I now need to pull in summaries based on diff criteria at the same time. So, in mega query, I have

...
Select ID, Sum(Cost) from tblParts where Type ='L'
...
Select ID, Sum(Cost) from tblParts where Type<>'L'

(I am simplifying the code above).

It runs, but both columns return 0s. If I cut one out, it runs correctly. I assume this is because I am trying to run 2 selects on the same data in the same query at the same time.

Any ideas on how to fix?

Thanks!
Ed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top