I need advise whether my database structure is correct and what is the appropriate query syntax that can be used.
Table1
╔═══╦════════════╦══════════════╦════════════╦═════════╦════════════╦══════════╗
║Id ║Country_id ║ Country ║ City ║ Grades ║ College_id ║Subscribed║
╠═══╬════════════╬══════════════╠════════════╬═════════╬════════════╬══════════╣
║ 1 ║ US ║ United States║ NY ║ 12 ║ 32299 ║ 1 ║
║ 2 ║ US ║ United States║ LA ║ 12 ║ 32299 ║ 0 ║
║ 3 ║ CA ║ Canada ║ ON ║ 13 ║ 32299 ║ 1 ║
║ 4 ║ CA ║ Canada ║ ON ║ 11 ║ 32299 ║ 1 ║
║ 5 ║ MEX ║ Mexico ║ DF ║ 12 ║ 32299 ║ 0 ║
║ 6 ║ MEX ║ Mexico ║ GUA ║ 12 ║ 32299 ║ 1 ║
╚═══╩════════════╩══════════════╩════════════╩═════════╩════════════╩══════════╝
Table 2
Where TableName = College_id ( 100 Tables with same Data structure)
╔═══╦════════════╦══════════════╦════════════╦═════════╦══════════════╦
║Id ║College_id ║ Student ║ Phone ║ Grades ║ College Name ║
╠═══╬════════════╬══════════════╠════════════╬═════════╬══════════════╣
║ 1 ║ 32299 ║ Jhon ║ 123-456 ║ 12 ║ UNV ║
║ 2 ║ 32299 ║ Eric ║ 123-457 ║ 12 ║ UNV ║
║ 3 ║ 32299 ║ Martha ║ 123-459 ║ 13 ║ UNV ║
║ 4 ║ 32299 ║ Steve ║ 123-458 ║ 11 ║ UNV ║
║ 5 ║ 32299 ║ Gloria ║ 123-451 ║ 12 ║ UNV ║
║ 6 ║ 32299 ║ Justin ║ 123-455 ║ 12 ║ UNV ║
╚═══╩════════════╩══════════════╩════════════╩═════════╩══════════════╝
I need help with the query syntax using the following criteria :
$table = Dropdown box Selection = College_id
$CountryId = Dropdown box Selection = Country_id
Select STUDENT, PHONE FROM $table WHERE :
College_id + Grades ( From table 2 ) = College_id + Grades (From Table 1)
AND Country_id = $CountryId
AND Subscribed = TRUE