How could I select * from table movies where seeds > 10 in table torrents? Table movies has unique id, while table torrents has id that matches the movie id. There are few torrents for each movie and having just one that has seeds greather than 10 should be selected.
The only sql I have is this where it deletes all movies which don’t have any torrents.
DELETE FROM movies WHERE NOT EXISTS ( SELECT id FROM torrents WHERE id=movies.id)
I’m not good at mysql at that level to make it, even with this example, which I also got from around here.
Help would be very much appreciated.
>Solution :
something like the following:
select *
from movies m
where exists (
select * from torrents t
where t.id = m.id and t.seeds > 10
);