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
 General SQL Server Forums
 New to SQL Server Programming
 Query question - Would like union type results

Author  Topic 

dbchud
Starting Member

13 Posts

Posted - 2009-08-21 : 05:34:35
Hi

I am trying to build a query that gives me the following:

item name table name
---------------
code table1
accountid table1
accountid2 table2
balance table3

I want to select one distinct code with one accountid, something like this:

code accountid accountid2 balance
codea 1 111 50
codeb 2 222 51
codec 3 333 52
coded 4 444 53

I have the results via individual queries, then adding the union clause - but this now results in one massive query and I suspect it doesn't need to be like that.

Hopefully that's enough info, would appreciate any help/ tips. If you need more pls advise.

Cheers
Gary

LoztInSpace
Aged Yak Warrior

940 Posts

Posted - 2009-08-21 : 21:17:03
without the tables, data and required output you are not going to get much help. Maybe it's clear to others but I can't understand what you start with nor what you want.
Go to Top of Page

dbchud
Starting Member

13 Posts

Posted - 2009-08-25 : 05:43:55
No worries, couldn't quite explain in the post above.

Think I figured it out, cheers anyway :)
Go to Top of Page
   

- Advertisement -