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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is SQL Union correct?

Status
Not open for further replies.

jcase

Technical User
Mar 31, 2006
1
GB
I'm a complete newbie but i'm trying to find out where i can find instructions to do this. I want to search multiple databases on my site from one form and have the results on the same page BUT seperated by what they are (not combined results). For example one database stores articles, and the other stores ebooks, and i want the articles and ebook results kept seperate.

I've been told that I need to look into sql union but i'm not sure because it seems as though the results will be combined. I would like the results page to show like this:

Articles (Database 1)
art1(result)
art2(result)
so on

Ebooks (Database 1)
ebook1(result)
ebook2(result)
so on

Can anyone point me in the right direction please of whether sql union is the correct way to go, or is there a better way to get the results i'm looking for?

Thanks for your help,
Justin.
 
As you want two separate resultset, then do two separate queries.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top