在mysql中应该怎么写?

来源:百度知道 编辑:UC知道 时间:2024/05/18 20:43:36
select top 90 sname,id,isnull(cnts,0) cnts from zjgs where id in (select zjid from users where datediff(d,dqdate,getdate())<=0) order by isnull(cnts,0) desc

select sname,id,isnull(cnts,0) cnts from zjgs where id in (select zjid from users where datediff(d,dqdate,getdate())<=0) order by isnull(cnts,0) desc limit 1,90

其中where datediff(d,dqdate,getdate())<=0)你自己要变一下。在mysql中如果日期型的字段好像也可以直接进行日期比较的。不过建议你具体查查mysql的语法。或者干脆把日期字段转成字符型字段。这样就可以自由比较了。