日期:2014-05-18 浏览次数:20636 次
//这个是求pddate与系统时间的天数差
select
bookId,bookName,booktypeId,pbName,author,
context,smallImg,bigImg,price,pbdate,
bookStates, ygcprice ,num
from bookInfo
where num<10 and Datediff(Day, pbdate, Getdate()) >= 15 order by
pbdate ,num asc
select top 5
bookId,bookName,booktypeId,pbName,author,
context,smallImg,bigImg,price,pbdate,
bookStates, ygcprice ,num
from bookInfo where bookStates <> 4 and booktypeId <> 0
and
bookId not in
(select top 0
bookId from bookInfo where bookStates <> 4 and booktypeId <> 0
)
select top 2
bookId,bookName,booktypeId,pbName,author,
context,smallImg,bigImg,price,pbdate,
bookStates, ygcprice ,num
from bookInfo where bookStates = 2 and booktypeId = 21
and
bookId not in
(select top 0
bookId from bookInfo where bookStates = 2 and booktypeId = 21
)