2

I've got the following two SQL tables (in proc SQL):

A
+----+------+--------------+
| id | age  | 
+----+------+
| 1  | 10   |
+----+------+
| 2  | 20   |
+----+------+
| 3  | 30   |
+----+------+
| 4  | 40   |
+----+------+

B
+----+
| id |
+----+
| 1  | 
+----
| 2  |
+----+
| 3  |  
+----+

The desired output would be: How do I get this output in proc sql

+----+------+
| id | age  | 
+----+------+
| 4  | 40   | 
+----+------+
Rahul Tripathi
  • 168,305
  • 31
  • 280
  • 331
Priyanka
  • 21
  • 1

2 Answers2

0

Try this

SELECT A.*
FROM A  NATURAL LEFT JOIN B
WHERE B.id IS NULL

SQL FIDDLE DEMO

Rahul Tripathi
  • 168,305
  • 31
  • 280
  • 331
0
select * from A
where not exists(select * from b
                 where B.ID=A.Id)
Rahul Tripathi
  • 168,305
  • 31
  • 280
  • 331
Priyanka
  • 21
  • 1