I have a database table that I would like to search twice, the first time to establish a list of entries meeting a certain criteria and then use that list to limit my second one showing ALL entries having the matching 'name'
The following query does what I want, but it takes forever is there an easy alternative that runs more optimally?
SELECT * FROM voting WHERE name IN (SELECT name FROM voting WHERE yob=15)
I also tried,
SELECT * FROM voting WHERE name = (SELECT name FROM voting WHERE yob=15)
this didn't work at all, but I think shows the logic of what I'm wanting to do. Thanks.
SELECT * from voting WHERE yob = 15not suffice?