Baran Topal

Baran Topal


October 2024
M T W T F S S
« Feb    
 123456
78910111213
14151617181920
21222324252627
28293031  

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)
)