Baran Topal

Baran Topal


May 2024
M T W T F S S
« Feb    
 12345
6789101112
13141516171819
20212223242526
2728293031  

Categories


some inner join

baranbaran

Say, I am having 2 tables, and in the 1st table, there is an ID and a age and in the 2nd table, there is a age, tallness, and if the first table’s age is equal to this tallness, the age in the second table should be searched in the first table’s age values and if not found, that row in the second table should be deleted.

Here you go:



delete from T2 where
T2.AGE in
(
select age from T2 inner join T1 on T1.age = T2.tallness
where T2.age not in  (select x.age from T1 as x)
)