Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Combining Two Queries
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

34 Posts

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

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

Flowing Fount of Yak Knowledge

2242 Posts

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

where tableA = 7 OR tableB = 5

Go to Top of Page
  Previous Topic Topic Next 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.02 seconds. Powered By: Snitz Forums 2000