select tableno
from tableinfo
where not exists (select * from orderbill inner join ordertable on ordertable.orderno=orderbill.orderno where ordertable.tableno=tableinfo.tableno
and cast(char(10,arrivetime,101)=cast(char(10,selectdate,101) and datename(hh,arrivedate)>=12)
from tableinfo
where not exists (select * from orderbill inner join ordertable on ordertable.orderno=orderbill.orderno where ordertable.tableno=tableinfo.tableno
and cast(char(10,arrivetime,101)=cast(char(10,selectdate,101) and datename(hh,arrivedate)>=12)
解决方案 »
- 在SQL Server 2005中删除一个用户
- 菜鸟第一次怎么学好数据结构
- 在一個表中如何將一個字段型的字段的數據復製到一個數據型的字段中
- 请问如何可以防止盗连?
- sqlserver2000异常:查询处理器未能用优化程序生成查询计划,因为查询无法同时更新聚集键和 text、ntext 或 image 列。
- (新手)急急 一个 存储过程的问题,应该对于你们挺简单的是个基础但是对我太难了 求解啊
- 帮下我 折磨死我了 分布式事务 泪奔....
- 在mssql中我想监视一个数据库的所有操作,用存储过程能实现吗?来着有分
- 如何改变一个字段的长度?
- 请问在建数据库的时候的filegrowth百分比的增长基数是什么?
- 有关存储过程和复杂SQL优化的办法..
- 能 Execute(@select + @where) into #temp_01 吗?
from tableinfo as c left join
(select b.tableno
from orderbill as a inner join ordertable as b on a.orderno=b.orderno
where (convert(20),arrivetime,121)<(convert(10),arrivetime,126)+' 12:00:00'
) as d on c.tableno=d.tableno
set @dt='2005-09-06'
select c.tableno,c.tablename,c.orderstate
from tableinfo as c left join
(select b.tableno
from orderbill as a inner join ordertable as b on a.orderno=b.orderno
where arrivetime<dateadd(hh,12,cast(@dt as datetime))
) as d on c.tableno=d.tableno
from tableinfo as c left join
(select b.tableno
from orderbill as a inner join ordertable as b on a.orderno=b.orderno
where convert(varchar(20),arrivetime,121)<convert(varchar(10),arrivetime,126)+' 12:00:00'
) as d on c.tableno=d.tableno