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

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Combining Two Queries

Author  Topic 

andypgill
Starting Member

34 Posts

Posted - 2012-11-23 : 05:05:40
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
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2012-11-23 : 06:35:50
Try with OR operator,

where tableA = 7 OR tableB = 5



--
Chandu
Go to Top of Page
   

- Advertisement -