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
 querying multiple tables based on a condition
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

ashley.s
Starting Member

Mauritius
9 Posts

Posted - 05/27/2012 :  03:13:35  Show Profile  Reply with Quote
Hello,
I have 3 tables. All three tables have a column called name of person. I need to find details about the name of the person.See syntax below.

select [Cage 1GdB].NameAddofAdd, [Cage 2GdB].NameAddofAdd, [Cage 3GdB].NameAddofAdd from [Cage 1GdB], [Cage 2GdB], [Cage 3GdB] where NameAddofAdd = 'ALISON SONY ROYAL ROAD BELVEDERE, LALLMATIE'

SwePeso
Patron Saint of Lost Yaks

Sweden
29138 Posts

Posted - 05/27/2012 :  08:25:04  Show Profile  Visit SwePeso's Homepage  Reply with Quote
SELECT NameAddOfAdd
FROM (
select NameAddofAdd FROM [Cage 1GdB]
UNION
SELECT NameAddofAdd FROM [Cage 2GdB]
UNION
SELETC NameAddofAdd FROM [Cage 3GdB]
) AS d
WHERE NameAddofAdd = 'ALISON SONY ROYAL ROAD BELVEDERE, LALLMATIE'



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
47189 Posts

Posted - 05/27/2012 :  11:33:17  Show Profile  Reply with Quote
quote:
Originally posted by ashley.s

Hello,
I have 3 tables. All three tables have a column called name of person. I need to find details about the name of the person.See syntax below.

select [Cage 1GdB].NameAddofAdd, [Cage 2GdB].NameAddofAdd, [Cage 3GdB].NameAddofAdd from [Cage 1GdB], [Cage 2GdB], [Cage 3GdB] where NameAddofAdd = 'ALISON SONY ROYAL ROAD BELVEDERE, LALLMATIE'


how should be your output? you want them in different columns or inside single column as values?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

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.05 seconds. Powered By: Snitz Forums 2000