Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

compare two columns

Status
Not open for further replies.

noizee666

Programmer
Aug 14, 2002
10
0
0
DE
Hi,

I have two tables in the same database. I want to compare one column from table A to table B. If a value from a.column is not in b.column this value should be returned.

The table A could have same values in it. Values in table B exists only one time.
example:
Column Table A Column Table B
1 1
1 2
2 4
2 5
3 7
3
3
3
4
5
5
5
6
6
7
7

The SQL statement should return 3 and 6 in this case. Because 3 and 6 is in Column A but not in Column B,


Thanks.

noizee
excuse my bad english
 
SELECT colB FROM tableB
MINUS
SELECT colA FROM tableA;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top