如何与where子句一起使用

时间:2019-05-11 08:06:01

标签: php sql

我想通过省略几行来合并两个表的行。通过合并两个表的某些特定行,可以再次获得我要省略的行。

我尝试了以下代码

$sx1=mysql_query("select distinct Name from exam1sem.invcount2 
WHERE Name not in (select  Name from exam1sem.invcount2 where 
Date='$ee2[Date]' AND Time='$ee2[Time]'
union
select  Name from exam1sem.reserve1 where Date='$ee2[Date]' AND 
Time='$ee2[Time]'
)  

union

select distinct Name from exam1sem.reserve1
WHERE Name not in (select  Name from exam1sem.invcount2 where 
Date='$ee2[Date]' AND Time='$ee2[Time]'
union
select  Name from exam1sem.reserve1 where Date='$ee2[Date]' AND 
Time='$ee2[Time]'
)  

order by Avail, TD, Seniority, NOD");

但是它不起作用。请提供任何线索。

0 个答案:

没有答案