SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Query question - Would like union type results
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

dbchud
Starting Member

13 Posts

Posted - 08/21/2009 :  05:34:35  Show Profile  Reply with Quote
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 - 08/21/2009 :  21:17:03  Show Profile  Reply with Quote
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 - 08/25/2009 :  05:43:55  Show Profile  Reply with Quote
No worries, couldn't quite explain in the post above.

Think I figured it out, cheers anyway :)
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000