SQL Statement for more than one type of code in the same column
I have a basic query where I am selecting from one table and joining to
another table. On the second table I am using a filter on a column to
exclude records I don't want.
The first table is basic, things like name, ID, address, etc. It contains
no duplicates. The second table (product table) is more like this:
ID Code DESC Date
-----------------------------------------
1234 PG Global 082613
1235 PG National 082613
1236 PS Serv1 082613
1237 PS Serv2 082613
1238 PS Serv3 082613
And my select looks something like this:
Select A.*, B.DESC
from CustTable A
INNER JOIN Prod_Table B
ON A.ID = B.ID
WHERE B.Code = 'PG'
I also have a need to get the records from the Prod_Table where Code = 'PS'.
Is there a way to do this in one query or do I need to make another table
with the 'PS' records and query that?
No comments:
Post a Comment