在子查询中将MS Access“TOP”转换为MySQL“LIMIT”

时间:2013-10-17 14:21:43

标签: mysql sql ms-access

我正在尝试将MS Access查询转换为MySQL,问题是将MS Access top转换为MySQL limit以获得相同的结果。当我将查询更改为limit时,我得到的错误是此版本的MySQL在子查询中不支持limit

这是MS Access查询:

SELECT  a.FK_CONTRIBUTOR_ID
FROM tPUBLISHERS 
INNER JOIN (tCONTRIBUTORS AS b 
    INNER JOIN tCLIPS AS a ON b.CONTRIBUTOR_ID = a.FK_CONTRIBUTOR_ID) 
    ON tPUBLISHERS.PUBLISHER_ID = b.FK_PUBLISHER_ID
WHERE ((a.CLIP_ID) In 
    (select top 5 CLIP_ID 
     from tCLIPS 
     where FK_CONTRIBUTOR_ID = a.FK_CONTRIBUTOR_ID 
         AND SUSPEND = a.SUSPEND)) 
    AND ((a.FK_CONTRIBUTOR_ID) In (1922,2034,2099))

1 个答案:

答案 0 :(得分:0)

之前回答: MySQL Subquery LIMIT

基本上将子查询更改为Join

谷歌更多关于“子查询的mysql限制”