- 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