谁能帮我把这个sqlserver语句转成mysql的
sqlserver的查询selecttop15*fromtopicwheretIDnotin(selecttop"+rowBegin+"tIDfromtopicorder...
sqlserver 的查询
select top 15 * from topic where tID not in (select top "+rowBegin+" tID from topic order by tState desc,tLastTime desc) order by tState desc,tLastTime desc
求达人帮忙, 展开
select top 15 * from topic where tID not in (select top "+rowBegin+" tID from topic order by tState desc,tLastTime desc) order by tState desc,tLastTime desc
求达人帮忙, 展开
1个回答
展开全部
第一:这个很难转化,mysql据我所知根本不能将limit内嵌。但是可以根据集合相交理论来变通。
第二:LZ放的分很少。(*^__^*) 嘻嘻……解决方法如下:
---------------------------------------------------------------------------
SELECT A.* FROM
(select * from topic LIMIT 0, 15) A
left join
(select * from topic LIMIT 0, 15) B
on (A.tID =B.tID )
where B.tID is null
order by A.tState desc,A.tLastTime desc
---------------------------------------------------------------------------
上边的15变成你传入的参数即可。
第二:LZ放的分很少。(*^__^*) 嘻嘻……解决方法如下:
---------------------------------------------------------------------------
SELECT A.* FROM
(select * from topic LIMIT 0, 15) A
left join
(select * from topic LIMIT 0, 15) B
on (A.tID =B.tID )
where B.tID is null
order by A.tState desc,A.tLastTime desc
---------------------------------------------------------------------------
上边的15变成你传入的参数即可。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询