34,590
社区成员
发帖
与我相关
我的任务
分享
select * from order_info as a where a.saleOrder=(select b.ext1_skill from ivrlog4ivrDlvInst as b where b.start_date=@date1 and se_id='55' and b.ext1_skill!='') and convert(varchar(10),a.instime,112)=@date2 and max(a.instime)
declare
@date1 varchar(20),
@date2 varchar(20)
set @date1='20100812'
set @date2='2010-08-12'
select * from order_info as a
where a.saleOrder=
(select b.ext1_skill from ivrlog4ivrDlvInst as b where b.start_date=@date1 and se_id='55' and b.ext1_skill!='')
and convert(varchar(10),a.instime,112)=@date2
and max(a.instime)
tables:
order_info
saleOrder varchar
instime varchar
ivrlog4ivrDlvInst
ext1_skill varchar
start_date varchar
start_time varchar
se_id varchar
select * from order_info as a
where a.saleOrder=(
select b.ext1_skill from ivrlog4ivrDlvInst as b
where b.start_date=@date1 and se_id='55'
and b.ext1_skill!='')
and convert(varchar(10),max(a.instime),112)=@date2
select b.caller, b.start_date, b.start_time, b.ext1_skill,
c.deliveryNo, c.destroyResult, c.deliveryDate, c.deliveryTime, c.arrangeTime, c.driverPhone, c.driverMobile,
a.serviceDate, a.serviceTime, a.workerTel
from order_info as a ,ivrlog4ivrDlvInst as b ,delivery_info as c
where
a.saleOrder in (select b.ext1_skill from ivrlog4ivrDlvInst where b.start_date=@date1 and b.se_id='55' and b.ext1_skill!='')
and convert(varchar(10),a.instime,112)=@date2
order by b.start_date desc, b.start_time desc
select * from order_info as a ,ivrlog4ivrDlvInst as b
where
(a.saleOrder=b.ext1_skill and b.start_date=@date1 and se_id='55' and b.ext1_skill!='')
and convert(varchar(10),a.instime,112)=@date2 and max(a.instime) --继续
服务器: 消息 147,级别 15,状态 1,行 4
聚合不应出现在 WHERE 子句中,除非该聚合位于 HAVING 子句或选择列表所包含的子查询中,并且要对其进行聚合的列是外部引用。
select * from order_info as a ,ivrlog4ivrDlvInst as b
where
a.saleOrder=b.ext1_skill and b.start_date=@date1 and se_id='55' and b.ext1_skill!='')
and convert(varchar(10),a.instime,112)=@date2 and max(a.instime) --继续