G
Guest
I have a table called Elections where All is Yes/No
Title ... ... All
I also have a table called HasVoted
ID Title
And a table called Students
Name ID ... ...
I need to write a query that finds all the Titles in Election where All = yes and checks to make sure that the Title doesn't exist in HasVoted for a given ID ssn.
this didn't work but I thought it was close:
SELECT Title t FROM Elections WHERE Elections.All = 'Yes' AND NOT EXISTS (SELECT ID FROM HasVoted WHERE ID = '" + s + "' AND Title = t);
Title ... ... All
I also have a table called HasVoted
ID Title
And a table called Students
Name ID ... ...
I need to write a query that finds all the Titles in Election where All = yes and checks to make sure that the Title doesn't exist in HasVoted for a given ID ssn.
this didn't work but I thought it was close:
SELECT Title t FROM Elections WHERE Elections.All = 'Yes' AND NOT EXISTS (SELECT ID FROM HasVoted WHERE ID = '" + s + "' AND Title = t);