访问替代 EXCEPT 子句 [英] Access substitute for EXCEPT clause

查看:52
本文介绍了访问替代 EXCEPT 子句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获得与在 ms access 中使用下面的 SQL 代码获得的结果相同的结果?它无法识别 EXCEPT 子句...

How can I get the same result I would get with the SQL code below in ms access? It does not recognize the EXCEPT clause...

SELECT DISTINCT 
       P.Name, 
       T.Training
  FROM Prof AS P, 
       Training_done AS TC, 
       Trainings AS T
 WHERE (P.Name Like '*' & NameProf & '*') 
   AND (P.Primary_Area = T.Cod_Area)
EXCEPT
SELECT DISTINCT 
       P.Name, 
       T.Training
  FROM Prof AS P, 
       Training_done AS TC, 
       Trainings AS T
 WHERE (P.Name Like '*' & NameProf & '*') 
   AND (P.Cod_Prof = TC.Cod_Prof);

提前致谢!

推荐答案

为了摆脱EXCEPT,你可以组合条件并否定第二个:

In order to get rid of the EXCEPT you could combine the conditions and negate the second one:

SELECT DISTINCT 
       P.Name, 
       T.Training
  FROM Prof AS P, 
       Training_done AS TC, 
       Trainings AS T
 WHERE ((P.Name Like '*' & NameProf & '*') AND
        (P.Primary_Area = T.Cod_Area)) 
   AND NOT ((P.Name Like '*' & NameProf & '*') AND
            (P.Cod_Prof = TC.Cod_Prof));

这篇关于访问替代 EXCEPT 子句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆