专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > 其他数据库

语法异常,帮看看。

发布时间:2010-05-24 21:28:22 文章来源:www.iduyao.cn 采编人员:星星草
语法错误,帮看看。。。
SQL code

ACCESS的
语法错误。 在查询表达式 '' 中。
 select top 20 * from bbs_content as a inner join 
(select replyTitleId from bbs_reply where replyUserName='zzxap')b
 on a.id=b.replyTitleId 
and a.[id]<=( select min([id]) from ( select TOP 1 c.id from bbs_content c inner join
 (select replyTitleId from bbs_reply where replyUserName='zzxap')d 
on c.id=d.replyTitleId ORDER BY c.id desc ) as e ) 
ORDER BY a.[id] desc



------解决方案--------------------
select top 20 * from bbs_content as a inner join (select replyTitleId from bbs_reply where replyUserName='zzxap') b on (a.id=b.replyTitleId )
where a.[id]<=(select min([id]) from ( select TOP 1 c.id from bbs_content c inner join (select replyTitleId from bbs_reply where replyUserName='zzxap') d on c.id=d.replyTitleId ORDER BY c.id desc ) as e)
 ORDER BY a.[id] desc



------解决方案--------------------
这个子句貌似没必要

select min([id]) from ( select TOP 1 c.id from bbs_content c inner join
 (select replyTitleId from bbs_reply where replyUserName='zzxap')d 
on c.id=d.replyTitleId ORDER BY c.id desc ) as e

只用这个应该就可以了
select TOP 1 c.id from bbs_content c inner join
 (select replyTitleId from bbs_reply where replyUserName='zzxap')d 
on c.id=d.replyTitleId ORDER BY c.id desc

或者
select Min(c.id) from bbs_content c inner join
 (select replyTitleId from bbs_reply where replyUserName='zzxap')d 
on c.id=d.replyTitleId
------解决方案--------------------
select top 20 * 
from bbs_content as a inner join 
(select replyTitleId from bbs_reply where replyUserName='zzxap') b
  on a.id=b.replyTitleId 
where a.[id]<=
( select min([id]) from 
( select TOP 1 c.id 
from bbs_content c inner join (select replyTitleId from bbs_reply where replyUserName='zzxap') d 
on c.id=d.replyTitleId 
ORDER BY c.id desc 
) as e 

ORDER BY a.[id] desc
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: