请教一个SQL语句,急,多谢 两个表, A: 人员(ID,name) B: 请假 (ID,人员ID,起始时间,结束时间) 我想查找今天没有请假的人员名单,请赐教 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select * from a inner join b on a.id=b.idwhere not (b.结束时间>=curdate() or 起始时间>=curdate()) orselect * from a inner join b on a.id=b.人员idwhere b.结束时间<curdate() and 起始时间<curdate() orselect * from a inner join b on a.id=b.人员idwhere not (curdate() between b.起始时间 and b.结束时间) select *from 人员where not exists (select 1 from 请假 where 人员ID=人员.ID and curdate between 起始时间 and 结束时间) select * from awhere not exists (select 1 from 请假 where 人员ID=a.ID and curdate() between 起始时间 and 结束时间) select * from 人员 where id not in (select 人员ID from 请假 where day(起始时间)=day(now()); select * from a where begindate>gedate or enddate <gedate left join b where a.id=b.id; A: 人员(ID,name) B: 请假 (ID,人员ID,起始时间,结束时间)===>select from a where not exists(select * from b where a.id=人员id and day(起始时间)=day(now())) Sybase转Mysql的问题,求大神!! 表字段值与另一表字段名相同问题。 mysql加载时区的问题 关于mysql的多表查询问题 mysql数据库怎么备份或者导出表呢?急!!!!!! mysql中,syslog()是什么意思? 精通MySQL4翻译出来了 递归查询 感觉脏读违反了事务的隔离性,请教 Mysql存储过程,插入新项后返回自动编号 mysql数据库备份文件怎么还原 求,mysql里有类似mssql里的sp_makewebtask吗?
where not (b.结束时间>=curdate() or 起始时间>=curdate())
select * from a inner join b on a.id=b.人员id
where b.结束时间<curdate() and 起始时间<curdate()
select * from a inner join b on a.id=b.人员id
where not (curdate() between b.起始时间 and b.结束时间)
from 人员
where not exists (select 1 from 请假 where 人员ID=人员.ID and curdate between 起始时间 and 结束时间)
where not exists (select 1 from 请假 where 人员ID=a.ID and curdate() between 起始时间 and 结束时间)
select * from 人员 where id not in (select 人员ID from 请假 where day(起始时间)=day(now());
人员(ID,name)
B:
请假 (ID,人员ID,起始时间,结束时间)===>
select
from a
where not exists(select * from b where a.id=人员id and day(起始时间)=day(now()))