$result = mysql_query("SELECT Name_Sc,Name_Tc,Requirement.ID_Sc,Requirement.ID_Tc
FROM School,Teacher,Requirement
WHERE School.ID_Sc = Requirement.ID_Sc and Teacher.ID_Tc = Requirement.ID_Tc and Requirement.Re_Status = 'connect'
AND NOT Requirement.ID_Sc,Requirement.ID_Tc
IN (
SELECT ID_Sc,ID_Tc
FROM Promise
)");
จะให้ Requirement.ID_Sc != Promise.ID_Sc and Requirement.ID_Tc != Promise.ID_Tc อะค่ะ
$result = mysql_query("SELECT Name_Sc,Name_Tc,Requirement.ID_Sc,Requirement.ID_Tc
FROM School,Teacher,Requirement
WHERE School.ID_Sc = Requirement.ID_Sc and Teacher.ID_Tc = Requirement.ID_Tc and Requirement.Re_Status = 'connect'
AND Requirement.ID_Sc,Requirement.ID_Tc NOT IN (
SELECT ID_Sc,ID_Tc
FROM Promise
)");
SELECT A.Name_Sc,B.Name_Tc,C.ID_Sc,C.ID_Tc
FROM School A,Teacher B,Requirement C
WHERE A.ID_Sc = C.ID_Sc and B.ID_Tc = C.ID_Tc and C.Re_Status = 'connect'
AND (C.ID_Sc,C.ID_Tc) NOT IN (SELECT ID_Sc,ID_Tc FROM Promise)