我是mysql的库,这个是sqlserver的写法,运行不了,我正在寻找这个语句select top 10 a.id,a.bookname,a.bookclass,b.classname,a.author,a.publish,a.bookno,a.content,a.prince,a.amount,a.Leav_number,a.regtime from My_book a,My_bookclass b where a.Bookclass = b.Id and a.Id not in ( select TOP 0 Id from My_book ORDER BY Id ) and a.Id in (select TOP 10 Id from My_book ORDER BY Id) order by a.Id desc的替代语句
我猜这应该是个分页查询语句,呵呵!mysql中可以直接select * from ...where...limit 0,10;
select a.id,a.bookname,a.bookclass,b.classname,a.author,a.publish,a.bookno,a.content,a.prince,a.amount,a.Leav_number,a.regtime from My_book a,My_bookclass b where a.Bookclass = b.Id and a.Id not in ( select Id from My_book ORDER BY Id LIMIT 0, 0) and a.Id in (select Id from My_book ORDER BY Id LIMIT 0, 10) order by a.Id desc LIMIT 0, 10这样改吗,还是不通啊
select a.id,a.bookname,a.bookclass,b.classname,a.author,a.publish,a.bookno,a.content,a.prince,a.amount,a.Leav_number,a.regtime from My_book a,My_bookclass b where a.Bookclass = b.Id order by a.Id LIMIT 0,10
这样改的话,查询条件没有发生变化吗,丢弃a.Id not in ( select Id from My_book ORDER BY Id LIMIT 0, 0) and a.Id in (select Id from My_book ORDER BY Id LIMIT 0, 10)不影响结果吗
select a.id,a.bookname,a.bookclass,b.classname,a.author,a.publish,a.bookno,a.content,a.prince,a.amount,a.Leav_number,a.regtime from My_book a,My_bookclass b where a.Bookclass = b.Id and a.Id not in ( 'select Id from My_book ORDER BY Id LIMIT 0, 0') and a.Id in ('select Id from My_book ORDER BY Id LIMIT 0, 10') order by a.Id desc LIMIT 0, 10为上面的a.Id not in ( select Id from My_book ORDER BY Id LIMIT 0, 0) and a.Id in (select Id from My_book ORDER BY Id LIMIT 0, 10)加上引号,好像过去了呀,哈哈,非常感谢mathematician(数学家) 的帮助
from My_book a,My_bookclass b
where a.Bookclass = b.Id
order by a.Id LIMIT 0,10