Baran Topal

Baran Topal


April 2024
M T W T F S S
« Feb    
1234567
891011121314
15161718192021
22232425262728
2930  

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