exists 的使用

Posted 莫大人

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了exists 的使用相关的知识,希望对你有一定的参考价值。

SELECT u.login_id,
(select 1 from dual where exists(select 1 from mdp_user_login_info muli where muli.BIZ_SYS = admin and u.login_id=muli.user_id 
and muli.LOGIN_TIME < now() and now() < muli.LOGOUT_TIME ) ) as attribute4 
FROM MDP_SEC_USER u WHERE u.DELETION_FLAG = F AND (u.TYPE = b OR u.TYPE = p) and u.login_id like %engwp%
ORDER BY u.ID limit 0,5;

 

查询某记录是否存在,存在返回 1

以上是关于exists 的使用的主要内容,如果未能解决你的问题,请参考以下文章