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
 Combining Two Queries
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

andypgill
Starting Member

34 Posts

Posted - 11/23/2012 :  05:05:40  Show Profile  Reply with Quote
Hi

I have a query that joins two tables with a full join therefore it should select all data from both tables.

This works fine if I don't use any criteria.

However I want to be able to select a month from each table (the month may be different) for example month 7 in tableA and month 5 in tableB

If I use where tableA = 7 and tableB = 5

This now only works if there is matching data (based on a common field) in both tables.

I want to be able to select all the month 7 data from table A and all the month 5 data from table B and add them together in a query.

Thanks for your help




bandi
Flowing Fount of Yak Knowledge

India
2215 Posts

Posted - 11/23/2012 :  06:35:50  Show Profile  Reply with Quote
Try with OR operator,

where tableA = 7 OR tableB = 5



--
Chandu
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