G
Guest
I'm having trouble building an SQL query. I have 2 tables
Students
Name Major ID Year
and
Elections
Title Major Year All
Given the name of a student, I need to find the title all the elections that student can vote in if his Major OR ID matches. Ignore the All field. Here's what I tried but it doesn't return a result:
"SELECT Title FROM Elections INNER JOIN Students ON Elections.Major = Student.Major WHERE Student.Name = '" + name + "'";
This won't even find the ones where the Major matches.
Students
Name Major ID Year
and
Elections
Title Major Year All
Given the name of a student, I need to find the title all the elections that student can vote in if his Major OR ID matches. Ignore the All field. Here's what I tried but it doesn't return a result:
"SELECT Title FROM Elections INNER JOIN Students ON Elections.Major = Student.Major WHERE Student.Name = '" + name + "'";
This won't even find the ones where the Major matches.