SQL:WHERE子句中的多个OR(UP)

时间:2015-09-23 07:47:12

标签: mysql sybase

你能帮我一把吗?我有一个名为“sql”的变量字符串。在该变量内部,它包含一个SQL查询。见下面的SQL。实际上,它在SQL的WHERE子句中有多个OR。当我试图在记录集中打开它时出现错误。请注意,如果“WHERE子句中的OR条件”仅为2或者说3它正在顺利运行。我的问题是为什么我收到此错误?我的SQL有什么问题吗?我认为没有。但是这个错误背后的主要原因是什么?

SELECT e.* FROM(
    SELECT d.* FROM (
        SELECT DISTINCT 
                    pg.name, 
                    a.projectid, 
                    a.lrsid, 
                    a.start_chainage, 
                    a.end_chainage, 
                    p.name, 
                    p.categoryid, 
                    p.oa, 
                    p.originid, 
                    p.statusid, 
                    p.cost, 
                    p.userid, 
                    p.io, 
                    p.apc, 
                    '' as placeholder1, 
                    '' as placeholder2, 
                    '' as placeholder3, 
                    '' as placeholder4, 
                    pg.name, 
                    pip.programid, 
                    a.sectionlrscode, 
                    a.length, 
                    a.projectid + ',' + a.lrsid + ',' + CONVERT(VARCHAR(20), CONVERT(decimal(9,2), a.start_chainage)) + ','  + CONVERT(VARCHAR(20), CONVERT(decimal(9,2), a.end_chainage)) + ',' + pg.name as multi  
        FROM        activity AS a 

        LEFT JOIN   project AS p 
            ON      p.projectid = a.projectid 

        LEFT JOIN   projectinprogram AS pip 
            ON      pip.projectid = a.projectid  

        LEFT JOIN   program AS pg 
            ON      pg.programid = pip.programid
    ) d 
    WHERE       d.multi = 'PR0001010LZ,S03799LZ,418.00,625.00,NEP 2016 Roads' 
        OR      d.multi='PR0001010LZ,S03799LZ,625.00,785.00,NEP 2016 Roads' 
        OR      d.multi='PR0001010LZ,S03799LZ,785.00,982.00,NEP 2016 Roads' 
        OR      d.multi='PR0001010LZ,S03799LZ,4342.00,4569.00,NEP 2016 Roads' 
        OR      d.multi='PR000701LZ,S03799LZ,4569.00,5211.00,NEP 2016 Roads' 
        OR      d.multi='PR0001010LZ,S03799LZ,24775.00,25017.00,NEP 2016 Roads' 
        OR      d.multi='PR0001010LZ,S03799LZ,25017.00,25224.00,NEP 2016 Roads' 
        OR      d.multi='PR0001010LZ,S03799LZ,28007.00,28289.00,NEP 2016 Roads' 
        OR      d.multi='PR0006142LZ,S03799LZ,28278.00,28340.00,NEP 2016 Roads' 
        OR      d.multi='PR0001025LZ,S03564LZ,0.00,822.00,NEP 2016 Roads' 
        OR      d.multi='PR0005668LZ,S03564LZ,0.00,1722.00,NEP 2016 Roads' 
        OR      d.multi='PR0001062LZ,S03732LZ,23067.00,23267.00,NEP 2016 Roads' 
        OR      d.multi='PR0003370LZ,S03732LZ,23067.00,24085.00,NEP 2016 Roads' 
        OR      d.multi='PR0001062LZ,S03732LZ,24564.00,25314.00,NEP 2016 Roads' 
        OR      d.multi='PR0005201LZ,S03732LZ,25267.00,25314.00,NEP 2016 Roads' 
        OR      d.multi='PR0001062LZ,S03732LZ,30304.00,30974.00,NEP 2016 Roads' 
        OR      d.multi='PR0003378LZ,S03732LZ,30574.00,31754.00,NEP 2016 Roads' 
        OR      d.multi='PR0001066LZ,S03767LZ,8166.00,8663.00,NEP 2016 Roads' 
        OR      d.multi='PR000704LZ,S03767LZ,7866.00,8166.00,NEP 2016 Roads' 
        OR      d.multi='PR0001271MN,S00639MN,49563.00,50109.00,NEP 2016 Roads' 
        OR      d.multi='PR0005313MN,S00639MN,49887.00,50280.00,NEP 2016 Roads' 
        OR      d.multi='PR0001275MN,S00610MN,8622.00,8767.00,NEP 2016 Roads' 
        OR      d.multi='PR0006514MN,S00610MN,8752.00,8802.00,NEP 2016 Roads' 
        OR      d.multi='PR0001283MN,S00654MN,24318.00,24570.00,NEP 2016 Roads' 
        OR      d.multi='PR0001283MN,S00654MN,24570.00,24573.00,NEP 2016 Roads' 
        OR      d.multi='PR0001283MN,S00654MN,29769.00,30556.00,NEP 2016 Roads' 
        OR      d.multi='PR0001714MN,S00654MN,30556.00,31278.00,NEP 2016 Roads' 
        OR      d.multi='PR0001290MN,S00654MN,31527.00,32528.00,NEP 2016 Roads' 
        OR      d.multi='PR0001290MN,S00654MN,32528.00,32628.00,NEP 2016 Roads' 
        OR      d.multi='PR0001715MN,S00654MN,31278.00,31527.00,NEP 2016 Roads' 
        OR      d.multi='PR0001292MN,S00654MN,33037.00,33828.00,NEP 2016 Roads' 
        OR      d.multi='PR0001293MN,S00654MN,32981.00,33307.00,NEP 2016 Roads' 
        OR      d.multi='PR0001293MN,S00654MN,33307.00,33548.00,NEP 2016 Roads' 
        OR      d.multi='PR0001293MN,S00654MN,33548.00,33828.00,NEP 2016 Roads' 
        OR      d.multi='PR0001293MN,S00654MN,34123.00,34411.00,NEP 2016 Roads' 
        OR      d.multi='PR000157MN,S00654MN,34411.00,34594.00,NEP 2016 Roads' 
        OR      d.multi='PR0001293MN,S00654MN,34594.00,35265.00,NEP 2016 Roads' 
        OR      d.multi='PR0001298MN,S00654MN,55714.00,56412.00,NEP 2016 Roads' 
        OR      d.multi='PR0001298MN,S00654MN,56412.00,56897.00,NEP 2016 Roads' 
        OR      d.multi='PR0001300MN,S00663MN,17713.00,18729.00,NEP 2016 Roads' 
        OR      d.multi='PR000501MN,S00663MN,18729.00,19579.00,NEP 2016 Roads' 
        OR      d.multi='PR0001301MN,S00621MN,3630.00,4013.00,NEP 2016 Roads' 
        OR      d.multi='PR0005324MN,S00621MN,1526.00,3659.00,NEP 2016 Roads' 
        OR      d.multi='PR0005324MN,S00621MN,3659.00,3959.00,NEP 2016 Roads' 
        OR      d.multi='PR0005324MN,S00621MN,3959.00,4065.00,NEP 2016 Roads' 
        OR      d.multi='PR0001301MN,S00621MN,6952.00,7195.00,NEP 2016 Roads' 
        OR      d.multi='PR0005331MN,S00621MN,5558.00,7186.00,NEP 2016 Roads' 
        OR      d.multi='PR0005331MN,S00621MN,7186.00,7329.00,NEP 2016 Roads' 
        OR      d.multi='PR0001301MN,S00621MN,14780.00,15015.00,NEP 2016 Roads' 
        OR      d.multi='PR0001301MN,S00621MN,15015.00,15494.00,NEP 2016 Roads' 
        OR      d.multi='PR0001301MN,S00621MN,27337.00,27592.00,NEP 2016 Roads' 
        OR      d.multi='PR0005360MN,S00621MN,27555.00,27945.00,NEP 2016 Roads' 
        OR      d.multi='PR0001316MN,S01353MN,14963.00,15782.00,NEP 2016 Roads' 
        OR      d.multi='PR000553MN,S01353MN,14400.00,14963.00,NEP 2016 Roads' 
        OR      d.multi='PR000553MN,S01353MN,14963.00,15782.00,NEP 2016 Roads' 
        OR      d.multi='PR0001318MN,S01373MN,6084.00,6980.00,NEP 2016 Roads' 
        OR      d.multi='PR0001318MN,S01373MN,6980.00,7075.00,NEP 2016 Roads' 
        OR      d.multi='PR0001318MN,S01373MN,7434.00,7497.00,NEP 2016 Roads' 
        OR      d.multi='PR0001318MN,S01373MN,7497.00,8022.00,NEP 2016 Roads' 
        OR      d.multi='PR0001318MN,S01373MN,8022.00,9026.00,NEP 2016 Roads' 
        OR      d.multi='PR0001331MN,S00926MN,22225.00,23223.00,NEP 2016 Roads' 
        OR      d.multi='PR000172MN,S00926MN,21529.00,22225.00,NEP 2016 Roads' 
        OR      d.multi='PR0001334MN,S01378MN,18188.00,18855.00,NEP 2016 Roads' 
        OR      d.multi='PR0001334MN,S01378MN,18855.00,19752.00,NEP 2016 Roads' 
        OR      d.multi='PR000177MN,S01378MN,17459.00,18188.00,NEP 2016 Roads' 
        OR      d.multi='PR0001336MN,S00914MN,4145.00,4714.00,NEP 2016 Roads' 
        OR      d.multi='PR0003148MN,S00914MN,3235.00,4340.00,NEP 2016 Roads' 
        OR      d.multi='PR0001336MN,S00914MN,7121.00,7670.00,NEP 2016 Roads' 
        OR      d.multi='PR0003148MN,S00914MN,7453.00,8558.00,NEP 2016 Roads' 
        OR      d.multi='PR0001336MN,S00914MN,33464.00,34067.00,NEP 2016 Roads' 
        OR      d.multi='PR0001336MN,S00914MN,34067.00,34264.00,NEP 2016 Roads' 
        OR      d.multi='PR0001336MN,S00914MN,34610.00,34776.00,NEP 2016 Roads' 
        OR      d.multi='PR0001336MN,S00914MN,34776.00,35522.00,NEP 2016 Roads' 
        OR      d.multi='PR000182MN,S00914MN,34610.00,34776.00,NEP 2016 Roads' 
        OR      d.multi='PR0001336MN,S00914MN,52714.00,53633.00,NEP 2016 Roads' 
        OR      d.multi='PR000182MN,S00914MN,52714.00,53633.00,NEP 2016 Roads' 
        OR      d.multi='PR0001336MN,S00914MN,54158.00,54590.00,NEP 2016 Roads' 
        OR      d.multi='PR0001336MN,S00914MN,54590.00,54659.00,NEP 2016 Roads' 
        OR      d.multi='PR0001336MN,S00914MN,54659.00,55462.00,NEP 2016 Roads' 
        OR      d.multi='PR000182MN,S00914MN,54659.00,55462.00,NEP 2016 Roads' 
        OR      d.multi='PR000182MN,S00914MN,55462.00,56004.00,NEP 2016 Roads' 
        OR      d.multi='PR0001336MN,S00914MN,56592.00,57596.00,NEP 2016 Roads' 
        OR      d.multi='PR000182MN,S00914MN,56592.00,57596.00,NEP 2016 Roads' 
        OR      d.multi='PR0001352MN,S00908MN,5780.00,6380.00,NEP 2016 Roads' 
        OR      d.multi='PR0006552MN,S00908MN,6180.00,6260.00,NEP 2016 Roads' 
        OR      d.multi='PR0001353MN,S01011MN,3096.00,4430.00,NEP 2016 Roads' 
        OR      d.multi='PR0005337MN,S01011MN,4245.00,5302.00,NEP 2016 Roads' 
        OR      d.multi='PR0001364MN,S01006MN,235.00,506.00,NEP 2016 Roads' 
        OR      d.multi='PR000190MN,S01006MN,506.00,1181.00,NEP 2016 Roads' 
        OR      d.multi='PR0001364MN,S01006MN,7195.00,7299.00,NEP 2016 Roads' 
        OR      d.multi='PR0001364MN,S01006MN,7299.00,7499.00,NEP 2016 Roads' 
        OR      d.multi='PR0001370MN,S00997MN,1207.00,1590.00,NEP 2016 Roads' 
        OR      d.multi='PR0003154MN,S00997MN,1207.00,1428.00,NEP 2016 Roads' 
        OR      d.multi='PR0001407MN,S00519MN,57879.00,58138.00,NEP 2016 Roads' 
        OR      d.multi='PR0001407MN,S00519MN,58138.00,58347.00,NEP 2016 Roads' 
        OR      d.multi='PR0001407MN,S00519MN,59382.00,59805.00,NEP 2016 Roads' 
        OR      d.multi='PR000201MN,S00519MN,59382.00,60102.00,NEP 2016 Roads' 
        OR      d.multi='PR0001441MN,S00692MN,45.00,500.00,NEP 2016 Roads' 
        OR      d.multi='PR0001441MN,S00692MN,500.00,1417.00,NEP 2016 Roads' 
        OR      d.multi='PR0001445MN,S00392MN,2005.00,2659.00,NEP 2016 Roads' 
        OR      d.multi='PR0003176MN,S00392MN,1971.00,2247.00,NEP 2016 Roads' 
        OR      d.multi='PR000508MN,S00392MN,1671.00,2005.00,NEP 2016 Roads' 
        OR      d.multi='PR0001447MN,S00446MN,6719.00,6756.00,NEP 2016 Roads' 
        OR      d.multi='PR0001447MN,S00446MN,6756.00,6881.00,NEP 2016 Roads' 
        OR      d.multi='PR0001451MN,S00439MN,15400.00,16333.00,NEP 2016 Roads' 
        OR      d.multi='PR0005242MN,S00439MN,16333.00,17895.00,NEP 2016 Roads' 
        OR      d.multi='PR0001451MN,S00439MN,71903.00,71927.00,NEP 2016 Roads' 
        OR      d.multi='PR0001451MN,S00439MN,71927.00,71948.00,NEP 2016 Roads' 
        OR      d.multi='PR0001498LZ,S00731LZ,17349.00,17741.00,NEP 2016 Roads' 
        OR      d.multi='PR0001498LZ,S00731LZ,17741.00,17879.00,NEP 2016 Roads' 
        OR      d.multi='PR00017LZ,S00731LZ,16749.00,17349.00,NEP 2016 Roads' 
        OR      d.multi='PR0001498LZ,S00731LZ,64074.00,64120.00,NEP 2016 Roads' 
        OR      d.multi='PR0001498LZ,S00731LZ,64120.00,64398.00,NEP 2016 Roads' 
        OR      d.multi='PR0001498LZ,S00731LZ,64398.00,64588.00,NEP 2016 Roads' 
        OR      d.multi='PR0001498LZ,S00731LZ,64588.00,64670.00,NEP 2016 Roads' 
        OR      d.multi='PR0001519LZ,S01911LZ,639.00,1186.00,NEP 2016 Roads' 
        OR      d.multi='PR00056LZ,S01911LZ,1186.00,2075.00,NEP 2016 Roads' 
        OR      d.multi='PR000924LZ,S01911LZ,0.00,639.00,NEP 2016 Roads' 
        OR      d.multi='PR0001520LZ,S01917LZ,0.00,767.00,NEP 2016 Roads' 
        OR      d.multi='PR00059LZ,S01917LZ,767.00,1397.00,NEP 2016 Roads' 
        OR      d.multi='PR0001523LZ,S04239LZ,4398.00,4464.00,NEP 2016 Roads' 
        OR      d.multi='PR0001523LZ,S04239LZ,4464.00,5411.00,NEP 2016 Roads' 
        OR      d.multi='PR000691LZ,S04239LZ,3760.00,4464.00,NEP 2016 Roads' 
        OR      d.multi='PR0006029LZ,S04239LZ,4469.00,4519.00,NEP 2016 Roads' 
        OR      d.multi='PR000153MN,S00647MN,14753.00,14954.00,NEP 2016 Roads' 
        OR      d.multi='PR000153MN,S00647MN,14954.00,15500.00,NEP 2016 Roads' 
        OR      d.multi='PR000153MN,S00647MN,17213.00,17722.00,NEP 2016 Roads' 
        OR      d.multi='PR000153MN,S00647MN,17722.00,18243.00,NEP 2016 Roads' 
        OR      d.multi='PR0001558LZ,S00319LZ,43678.00,46576.00,NEP 2016 Roads' 
        OR      d.multi='PR0001558LZ,S00319LZ,46421.00,46576.00,NEP 2016 Roads' 
        OR      d.multi='PR000314LZ,S00319LZ,46421.00,46940.00,NEP 2016 Roads' 
        OR      d.multi='PR000794LZ,S00319LZ,46008.00,46421.00,NEP 2016 Roads' 
        OR      d.multi='PR0001558LZ,S00319LZ,53338.00,53582.00,NEP 2016 Roads' 
        OR      d.multi='PR0005403LZ,S00319LZ,53582.00,56617.00,NEP 2016 Roads' 
        OR      d.multi='PR0001577LZ,S01030LZ,4952.00,6539.00,NEP 2016 Roads' 
        OR      d.multi='PR0002934LZ,S01030LZ,4099.00,6539.00,NEP 2016 Roads' 
        OR      d.multi='PR0001584LZ,S00967LZ,18953.00,19596.00,NEP 2016 Roads' 
        OR      d.multi='PR0001584LZ,S00967LZ,19596.00,19956.00,NEP 2016 Roads' 
        OR      d.multi='PR0001600LZ,S01372LZ,1190.00,1427.00,NEP 2016 Roads' 
        OR      d.multi='PR000634LZ,S01372LZ,679.00,1190.00,NEP 2016 Roads' 
        OR      d.multi='PR0001600LZ,S01372LZ,3654.00,4043.00,NEP 2016 Roads' 
        OR      d.multi='PR000634LZ,S01372LZ,3240.00,3654.00,NEP 2016 Roads' 
        OR      d.multi='PR0001602LZ,S01373LZ,120.00,183.00,NEP 2016 Roads' 
        OR      d.multi='PR000638LZ,S01373LZ,183.00,327.00,NEP 2016 Roads' 
        OR      d.multi='PR0001602LZ,S01373LZ,3441.00,3706.00,NEP 2016 Roads' 
        OR      d.multi='PR000638LZ,S01373LZ,3241.00,3441.00,NEP 2016 Roads' 
        OR      d.multi='PR000638LZ,S01373LZ,3706.00,3954.00,NEP 2016 Roads' 
        OR      d.multi='PR0001611MN,S00621MN,0.00,108.00,NEP 2016 Roads' 
        OR      d.multi='PR0005324MN,S00621MN,0.00,1226.00,NEP 2016 Roads' 
        OR      d.multi='PR000161MN,S00621MN,7344.00,7461.00,NEP 2016 Roads' 
        OR      d.multi='PR000161MN,S00621MN,7461.00,8318.00,NEP 2016 Roads' 
        OR      d.multi='PR000161MN,S00621MN,30951.00,31458.00,NEP 2016 Roads' 
        OR      d.multi='PR000161MN,S00621MN,31458.00,31962.00,NEP 2016 Roads' 
        OR      d.multi='PR000161MN,S00621MN,31962.00,32369.00,NEP 2016 Roads' 
        OR      d.multi='PR0001621MN,S00458MN,126.00,536.00,NEP 2016 Roads' 
        OR      d.multi='PR0001621MN,S00458MN,536.00,678.00,NEP 2016 Roads' 
        OR      d.multi='PR0001621MN,S00458MN,678.00,976.00,NEP 2016 Roads' 
        OR      d.multi='PR0001621MN,S00458MN,1094.00,2005.00,NEP 2016 Roads' 
        OR      d.multi='PR0001621MN,S00458MN,2005.00,2934.00,NEP 2016 Roads' 
        OR      d.multi='PR0003177MN,S00458MN,76.00,2766.00,NEP 2016 Roads' 
        OR      d.multi='PR0001679LZ,S01191LZ,1256.00,1395.00,NEP 2016 Roads' 
        OR      d.multi='PR0001679LZ,S01191LZ,1395.00,1473.00,NEP 2016 Roads' 
        OR      d.multi='PR0001679LZ,S01191LZ,1473.00,1623.00,NEP 2016 Roads' 
        OR      d.multi='PR0001679LZ,S01195LZ,1806.00,2395.00,NEP 2016 Roads' 
        OR      d.multi='PR0001679LZ,S01195LZ,2395.00,3301.00,NEP 2016 Roads' 
        OR      d.multi='PR00049LZ,S01195LZ,3263.00,4204.00,NEP 2016 Roads' 
        OR      d.multi='PR0001679LZ,S01195LZ,3321.00,3400.00,NEP 2016 Roads' 
        OR      d.multi='PR0001679LZ,S01195LZ,3400.00,3460.00,NEP 2016 Roads' 
        OR      d.multi='PR0001679LZ,S01195LZ,6380.00,6932.00,NEP 2016 Roads' 
        OR      d.multi='PR0001679LZ,S01195LZ,6932.00,7015.00,NEP 2016 Roads' 
        OR      d.multi='PR0001679LZ,S01195LZ,7015.00,7394.50,NEP 2016 Roads' 
        OR      d.multi='PR0001679LZ,S01195LZ,7394.50,7533.50,NEP 2016 Roads' 
        OR      d.multi='PR0001701LZ,S00731LZ,3875.00,4025.00,NEP 2016 Roads' 
        OR      d.multi='PR0001701LZ,S00731LZ,4025.00,4210.00,NEP 2016 Roads' 
        OR      d.multi='PR0001709LZ,S03784LZ,38456.00,38715.00,NEP 2016 Roads' 
        OR      d.multi='PR0001710LZ,S03784LZ,38715.00,39107.00,NEP 2016 Roads' 
        OR      d.multi='PR000170LZ,S04074LZ,18368.00,20368.00,NEP 2016 Roads' 
        OR      d.multi='PR0004993LZ,S04074LZ,20368.00,22224.00,NEP 2016 Roads' 
        OR      d.multi='PR0005254LZ,S04074LZ,17176.00,18588.00,NEP 2016 Roads' 
        OR      d.multi='PR000172MN,S00926MN,18937.00,20221.00,NEP 2016 Roads' 
        OR      d.multi='PR0003142MN,S00926MN,18040.00,19857.00,NEP 2016 Roads' 
        OR      d.multi='PR000172MN,S00926MN,24225.00,25230.00,NEP 2016 Roads' 
        OR      d.multi='PR000172MN,S00926MN,25230.00,26216.00,NEP 2016 Roads' 
        OR      d.multi='PR000172MN,S00926MN,26216.00,26565.00,NEP 2016 Roads' 
        OR      d.multi='PR0005809LZ,S00731LZ,16749.00,17249.00,NEP 2016 Roads' 
        OR      d.multi='PR000188MN,S00957MN,39000.00,39807.00,NEP 2016 Roads' 
        OR      d.multi='PR000188MN,S00957MN,39807.00,40346.00,NEP 2016 Roads' 
        OR      d.multi='PR000194MN,S00476MN,0.00,389.00,NEP 2016 Roads' 
        OR      d.multi='PR0005351MN,S00476MN,0.00,436.00,NEP 2016 Roads' 
        OR      d.multi='PR000194MN,S00485MN,13643.00,14176.00,NEP 2016 Roads' 
        OR      d.multi='PR000194MN,S00485MN,14176.00,15132.00,NEP 2016 Roads' 
        OR      d.multi='PR000194MN,S00485MN,26370.00,26856.00,NEP 2016 Roads' 
        OR      d.multi='PR000194MN,S00485MN,26856.00,27448.00,NEP 2016 Roads' 
        OR      d.multi='PR000194MN,S00485MN,43155.00,43873.00,NEP 2016 Roads' 
        OR      d.multi='PR000194MN,S00485MN,43873.00,44454.00,NEP 2016 Roads' 
        OR      d.multi='PR000201MN,S00519MN,49332.00,49845.00,NEP 2016 Roads' 
        OR      d.multi='PR000201MN,S00519MN,49417.00,49845.00,NEP 2016 Roads' 
        OR      d.multi='PR000208MN,S00126MN,3127.00,3236.00,NEP 2016 Roads' 
        OR      d.multi='PR000208MN,S00126MN,3236.00,3608.00,NEP 2016 Roads' 
        OR      d.multi='PR000208MN,S00126MN,4907.00,5076.00,NEP 2016 Roads' 
        OR      d.multi='PR000208MN,S00126MN,5076.00,5256.00,NEP 2016 Roads' 
        OR      d.multi='PR000208MN,S00126MN,5345.00,5861.00,NEP 2016 Roads' 
        OR      d.multi='PR0005062MN,S00126MN,0.00,5534.00,NEP 2016 Roads' 
        OR      d.multi='PR00020LZ,S00760LZ,43365.00,43546.00,NEP 2016 Roads' 
        OR      d.multi='PR00020LZ,S00760LZ,43546.00,43946.00,NEP 2016 Roads' 
        OR      d.multi='PR000814LZ,S00760LZ,43946.00,44379.00,NEP 2016 Roads' 
        OR      d.multi='PR000225MN,S00220MN,14036.00,14583.00,NEP 2016 Roads' 
        OR      d.multi='PR000225MN,S00220MN,14583.00,14727.00,NEP 2016 Roads' 
        OR      d.multi='PR000225MN,S00220MN,31804.00,32410.00,NEP 2016 Roads' 
        OR      d.multi='PR000225MN,S00220MN,32410.00,32561.00,NEP 2016 Roads' 
        OR      d.multi='PR000229MN,S00439MN,13928.00,14429.00,NEP 2016 Roads' 
        OR      d.multi='PR0005242MN,S00439MN,9400.00,14429.00,NEP 2016 Roads' 
        OR      d.multi='PR000231MN,S00421MN,1068.00,2142.00,NEP 2016 Roads' 
        OR      d.multi='PR000231MN,S00421MN,2142.00,5561.00,NEP 2016 Roads' 
        OR      d.multi='PR000236LZ,S05991LZ,11761.00,12685.00,NEP 2016 Roads' 
        OR      d.multi='PR0005010LZ,S05991LZ,10269.00,12265.00,NEP 2016 Roads' 
        OR      d.multi='PR000236LZ,S05991LZ,13249.00,14011.00,NEP 2016 Roads' 
        OR      d.multi='PR000236LZ,S05991LZ,14011.00,14279.00,NEP 2016 Roads' 
        OR      d.multi='PR000239LZ,S01313LZ,0.00,871.00,NEP 2016 Roads' 
        OR      d.multi='PR000239LZ,S01313LZ,871.00,1290.00,NEP 2016 Roads' 
        OR      d.multi='PR000239LZ,S01313LZ,12436.00,13293.00,NEP 2016 Roads' 
        OR      d.multi='PR000239LZ,S01313LZ,13293.00,14123.00,NEP 2016 Roads' 
        OR      d.multi='PR000248LZ,S05009LZ,8689.00,9585.00,NEP 2016 Roads' 
        OR      d.multi='PR000248LZ,S05009LZ,9585.00,10503.00,NEP 2016 Roads' 
        OR      d.multi='PR00024LZ,S00782LZ,6738.00,7487.00,NEP 2016 Roads' 
        OR      d.multi='PR0005150LZ,S00782LZ,4036.00,6953.00,NEP 2016 Roads' 
        OR      d.multi='PR0006LZ,S00782LZ,7487.00,8020.00,NEP 2016 Roads' 
        OR      d.multi='PR00025LZ,S00857LZ,53514.00,54093.00,NEP 2016 Roads' 
        OR      d.multi='PR00025LZ,S00857LZ,54093.00,54749.00,NEP 2016 Roads' 
        OR      d.multi='PR00025LZ,S00857LZ,54093.00,54851.00,NEP 2016 Roads' 
        OR      d.multi='PR000832LZ,S00857LZ,53246.00,53514.00,NEP 2016 Roads' 
        OR      d.multi='PR0005825LZ,S00857LZ,54696.00,54746.00,NEP 2016 Roads' 
        OR      d.multi='PR00025LZ,S00857LZ,59750.00,59805.00,NEP 2016 Roads' 
        OR      d.multi='PR00025LZ,S00857LZ,59805.00,59815.00,NEP 2016 Roads' 
        OR      d.multi='PR00025LZ,S00857LZ,60451.00,60760.00,NEP 2016 Roads' 
        OR      d.multi='PR000832LZ,S00857LZ,60760.00,61099.00,NEP 2016 Roads' 
        OR      d.multi='PR000278LZ,S03955LZ,1823.00,2502.00,NEP 2016 Roads' 
        OR      d.multi='PR000278LZ,S03955LZ,2502.00,3060.00,NEP 2016 Roads' 
        OR      d.multi='PR0003737LZ,S02043LZ,6502.00,11813.00,NEP 2016 Roads' 
        OR      d.multi='PR0003738LZ,S02043LZ,11813.00,15813.00,NEP 2016 Roads' 
        OR      d.multi='PR0003739LZ,S02057LZ,23667.00,25414.00,NEP 2016 Roads' 
        OR      d.multi='PR0003742LZ,S02057LZ,25414.00,27476.00,NEP 2016 Roads' 
        OR      d.multi='PR0003745LZ,S04252LZ,2562.00,6312.00,NEP 2016 Roads' 
        OR      d.multi='PR0003746LZ,S04252LZ,6312.00,7562.00,NEP 2016 Roads' 
        OR      d.multi='PR0003746LZ,S04252LZ,7562.00,8096.00,NEP 2016 Roads' 
        OR      d.multi='PR0003746LZ,S04252LZ,8096.00,10717.00,NEP 2016 Roads' 
        OR      d.multi='PR0003749LZ,S04252LZ,10717.00,12384.00,NEP 2016 Roads' 
        OR      d.multi='PR0003749LZ,S04252LZ,12384.00,13096.00,NEP 2016 Roads' 
        OR      d.multi='PR0003749LZ,S04252LZ,13096.00,16356.00,NEP 2016 Roads' 
        OR      d.multi='PR0003752LZ,S04253LZ,5033.00,7533.00,NEP 2016 Roads' 
        OR      d.multi='PR0003753LZ,S04253LZ,7533.00,9668.00,NEP 2016 Roads' 
        OR      d.multi='PR0003756LZ,S04227LZ,14497.00,14949.00,NEP 2016 Roads' 
        OR      d.multi='PR0003764LZ,S04227LZ,14949.00,15350.00,NEP 2016 Roads' 
        OR      d.multi='PR000376LZ,S04312LZ,0.00,750.00,NEP 2016 Roads' 
        OR      d.multi='PR000376LZ,S04312LZ,750.00,1610.00,NEP 2016 Roads' 
        OR      d.multi='PR000376LZ,S04312LZ,1610.00,2393.20,NEP 2016 Roads' 
        OR      d.multi='PR0003828MN,S01146MN,61016.00,64766.00,NEP 2016 Roads' 
        OR      d.multi='PR0003829MN,S01146MN,64766.00,66016.00,NEP 2016 Roads' 
        OR      d.multi='PR0003829MN,S01146MN,66016.00,68516.00,NEP 2016 Roads' 
        OR      d.multi='PR0003831MN,S01146MN,68516.00,71016.00,NEP 2016 Roads' 
        OR      d.multi='PR0003831MN,S01146MN,71016.00,72266.00,NEP 2016 Roads' 
        OR      d.multi='PR0003833MN,S01146MN,72266.00,76016.00,NEP 2016 Roads' 
        OR      d.multi='PR0003834MN,S01146MN,76016.00,79766.00,NEP 2016 Roads' 
        OR      d.multi='PR0003835MN,S01146MN,79766.00,81016.00,NEP 2016 Roads' 
        OR      d.multi='PR0003835MN,S01146MN,81016.00,83516.00,NEP 2016 Roads' 
        OR      d.multi='PR0003837MN,S01146MN,83516.00,86016.00,NEP 2016 Roads' 
        OR      d.multi='PR0003838MN,S01146MN,86016.00,89766.00,NEP 2016 Roads' 
        OR      d.multi='PR0003839MN,S01146MN,89766.00,93292.00,NEP 2016 Roads' 
        OR      d.multi='PR0003841MN,S01038MN,30137.00,30812.00,NEP 2016 Roads' 
        OR      d.multi='PR0003849MN,S01038MN,30812.00,30901.00,NEP 2016 Roads' 
        OR      d.multi='PR0003849MN,S01038MN,30901.00,31901.00,NEP 2016 Roads' 
        OR      d.multi='PR0003849MN,S01038MN,31901.00,32338.00,NEP 2016 Roads' 
        OR      d.multi='PR0003849MN,S01038MN,32542.00,32722.00,NEP 2016 Roads' 
        OR      d.multi='PR0003849MN,S01038MN,32722.00,33442.00,NEP 2016 Roads' 
        OR      d.multi='PR0003849MN,S01038MN,33454.00,34901.00,NEP 2016 Roads' 
        OR      d.multi='PR0003849MN,S01038MN,34901.00,35697.00,NEP 2016 Roads' 
        OR      d.multi='PR0003856MN,S01038MN,37816.00,37901.00,NEP 2016 Roads' 
        OR      d.multi='PR0003856MN,S01038MN,37901.00,37994.00,NEP 2016 Roads' 
        OR      d.multi='PR0003856MN,S01038MN,37994.00,38146.00,NEP 2016 Roads' 
        OR      d.multi='PR0003856MN,S01038MN,38370.00,38870.00,NEP 2016 Roads' 
        OR      d.multi='PR0003856MN,S01038MN,38870.00,39184.00,NEP 2016 Roads' 
        OR      d.multi='PR0006502MN,S01038MN,39181.00,39341.00,NEP 2016 Roads' 
        OR      d.multi='PR0003856MN,S01038MN,40901.00,41125.00,NEP 2016 Roads' 
        OR      d.multi='PR0003865MN,S01038MN,41125.00,41324.00,NEP 2016 Roads' 
        OR      d.multi='PR0003865MN,S01038MN,48419.00,48901.00,NEP 2016 Roads' 
        OR      d.multi='PR0003865MN,S01038MN,48901.00,49008.00,NEP 2016 Roads' 
        OR      d.multi='PR0003865MN,S01038MN,49944.00,50140.00,NEP 2016 Roads' 
        OR      d.multi='PR0003876MN,S01038MN,50140.00,51146.00,NEP 2016 Roads' 
        OR      d.multi='PR0003883MN,S01038MN,53980.00,54218.00,NEP 2016 Roads' 
        OR      d.multi='PR0003883MN,S01038MN,54218.00,54901.00,NEP 2016 Roads' 
        OR      d.multi='PR0003883MN,S01038MN,57150.00,57901.00,NEP 2016 Roads' 
        OR      d.multi='PR0003883MN,S01038MN,57901.00,58901.00,NEP 2016 Roads' 
        OR      d.multi='PR0003939MN,S01369MN,8871.00,9934.00,NEP 2016 Roads' 
        OR      d.multi='PR0003944MN,S01369MN,9934.00,10220.00,NEP 2016 Roads'
) e

WHERE       e.programid ='P_CO-ITTS-227_09172015_083200' 

ORDER BY    e.projectid, 
            e.start_chainage, 
            e.end_chainage ASC;

错误是:

  

错误-2147217887(ODBC驱动程序不支持请求的属性。)在类模块clsViewERO的过程OpenRecordset中

3 个答案:

答案 0 :(得分:0)

你被跳过")"在生成' multi'列期间。 但正如之前所说,更好的用户IN而不是OR。 但看起来你可以将这些常量放入表变量中并像表格一样使用它们。

答案 1 :(得分:0)

    SELECT DISTINCT 
            pg.name, 
            a.projectid, 
            a.lrsid, 
            a.start_chainage, 
            a.end_chainage, 
            p.name, 
            p.categoryid, 
            p.oa, 
            p.originid, 
            p.statusid, 
            p.cost, 
            p.userid, 
            p.io, 
            p.apc, 
            '' as placeholder1, 
            '' as placeholder2, 
            '' as placeholder3, 
            '' as placeholder4, 
            pg.name, 
            pip.programid, 
            a.sectionlrscode, 
            a.length, 
            a.projectid + ',' + a.lrsid + ',' + CONVERT(VARCHAR(20), CONVERT(decimal(9,2), a.start_chainage)) + ','  + CONVERT(VARCHAR(20), CONVERT(decimal(9,2), a.end_chainage)) + ',' + pg.name as multi  
FROM activity AS a 
LEFT JOIN project AS p ON p.projectid = a.projectid
LEFT JOIN projectinprogram AS pip ON pip.projectid = a.projectid 
LEFT JOIN program AS pg ON pg.programid = pip.programid 
WHERE a.projectid + ',' + a.lrsid + ',' + CONVERT(VARCHAR(20), CONVERT(decimal(9,2), a.start_chainage)) + ','  + CONVERT(VARCHAR(20), CONVERT(decimal(9,2), a.end_chainage)) + ',' + pg.name IN (
        'PR0001010LZ,S03799LZ,418.00,625.00,NEP 2016 Roads' 
        ,'PR0001010LZ,S03799LZ,625.00,785.00,NEP 2016 Roads' 
        ,'PR0001010LZ,S03799LZ,785.00,982.00,NEP 2016 Roads' 
        ,'PR0001010LZ,S03799LZ,4342.00,4569.00,NEP 2016 Roads' 
        ,'PR000701LZ,S03799LZ,4569.00,5211.00,NEP 2016 Roads' 
        ,'PR0001010LZ,S03799LZ,24775.00,25017.00,NEP 2016 Roads' 
        ,'PR0001010LZ,S03799LZ,25017.00,25224.00,NEP 2016 Roads' 
        ,'PR0001010LZ,S03799LZ,28007.00,28289.00,NEP 2016 Roads' 
        ,'PR0006142LZ,S03799LZ,28278.00,28340.00,NEP 2016 Roads' 
        ,'PR0001025LZ,S03564LZ,0.00,822.00,NEP 2016 Roads' 
        ,'PR0005668LZ,S03564LZ,0.00,1722.00,NEP 2016 Roads' 
        ,'PR0001062LZ,S03732LZ,23067.00,23267.00,NEP 2016 Roads' 
        ,'PR0003370LZ,S03732LZ,23067.00,24085.00,NEP 2016 Roads' 
        ,'PR0001062LZ,S03732LZ,24564.00,25314.00,NEP 2016 Roads' 
        ,'PR0005201LZ,S03732LZ,25267.00,25314.00,NEP 2016 Roads' 
        ,'PR0001062LZ,S03732LZ,30304.00,30974.00,NEP 2016 Roads' 
        ,'PR0003378LZ,S03732LZ,30574.00,31754.00,NEP 2016 Roads' 
        ,'PR0001066LZ,S03767LZ,8166.00,8663.00,NEP 2016 Roads' 
        ,'PR000704LZ,S03767LZ,7866.00,8166.00,NEP 2016 Roads' 
        ,'PR0001271MN,S00639MN,49563.00,50109.00,NEP 2016 Roads' 
        ,'PR0005313MN,S00639MN,49887.00,50280.00,NEP 2016 Roads' 
        ,'PR0001275MN,S00610MN,8622.00,8767.00,NEP 2016 Roads' 
        ,'PR0006514MN,S00610MN,8752.00,8802.00,NEP 2016 Roads' 
        ,'PR0001283MN,S00654MN,24318.00,24570.00,NEP 2016 Roads' 
        ,'PR0001283MN,S00654MN,24570.00,24573.00,NEP 2016 Roads' 
        ,'PR0001283MN,S00654MN,29769.00,30556.00,NEP 2016 Roads' 
        ,'PR0001714MN,S00654MN,30556.00,31278.00,NEP 2016 Roads' 
        ,'PR0001290MN,S00654MN,31527.00,32528.00,NEP 2016 Roads' 
        ,'PR0001290MN,S00654MN,32528.00,32628.00,NEP 2016 Roads' 
        ,'PR0001715MN,S00654MN,31278.00,31527.00,NEP 2016 Roads' 
        ,'PR0001292MN,S00654MN,33037.00,33828.00,NEP 2016 Roads' 
        ,'PR0001293MN,S00654MN,32981.00,33307.00,NEP 2016 Roads' 
        ,'PR0001293MN,S00654MN,33307.00,33548.00,NEP 2016 Roads' 
        ,'PR0001293MN,S00654MN,33548.00,33828.00,NEP 2016 Roads' 
        ,'PR0001293MN,S00654MN,34123.00,34411.00,NEP 2016 Roads' 
        ,'PR000157MN,S00654MN,34411.00,34594.00,NEP 2016 Roads' 
        ,'PR0001293MN,S00654MN,34594.00,35265.00,NEP 2016 Roads' 
        ,'PR0001298MN,S00654MN,55714.00,56412.00,NEP 2016 Roads' 
        ,'PR0001298MN,S00654MN,56412.00,56897.00,NEP 2016 Roads' 
        ,'PR0001300MN,S00663MN,17713.00,18729.00,NEP 2016 Roads' 
        ,'PR000501MN,S00663MN,18729.00,19579.00,NEP 2016 Roads' 
        ,'PR0001301MN,S00621MN,3630.00,4013.00,NEP 2016 Roads' 
        ,'PR0005324MN,S00621MN,1526.00,3659.00,NEP 2016 Roads' 
        ,'PR0005324MN,S00621MN,3659.00,3959.00,NEP 2016 Roads' 
        ,'PR0005324MN,S00621MN,3959.00,4065.00,NEP 2016 Roads' 
        ,'PR0001301MN,S00621MN,6952.00,7195.00,NEP 2016 Roads' 
        ,'PR0005331MN,S00621MN,5558.00,7186.00,NEP 2016 Roads' 
        ,'PR0005331MN,S00621MN,7186.00,7329.00,NEP 2016 Roads' 
        ,'PR0001301MN,S00621MN,14780.00,15015.00,NEP 2016 Roads' 
        ,'PR0001301MN,S00621MN,15015.00,15494.00,NEP 2016 Roads' 
        ,'PR0001301MN,S00621MN,27337.00,27592.00,NEP 2016 Roads' 
        ,'PR0005360MN,S00621MN,27555.00,27945.00,NEP 2016 Roads' 
        ,'PR0001316MN,S01353MN,14963.00,15782.00,NEP 2016 Roads' 
        ,'PR000553MN,S01353MN,14400.00,14963.00,NEP 2016 Roads' 
        ,'PR000553MN,S01353MN,14963.00,15782.00,NEP 2016 Roads' 
        ,'PR0001318MN,S01373MN,6084.00,6980.00,NEP 2016 Roads' 
        ,'PR0001318MN,S01373MN,6980.00,7075.00,NEP 2016 Roads' 
        ,'PR0001318MN,S01373MN,7434.00,7497.00,NEP 2016 Roads' 
        ,'PR0001318MN,S01373MN,7497.00,8022.00,NEP 2016 Roads' 
        ,'PR0001318MN,S01373MN,8022.00,9026.00,NEP 2016 Roads' 
        ,'PR0001331MN,S00926MN,22225.00,23223.00,NEP 2016 Roads' 
        ,'PR000172MN,S00926MN,21529.00,22225.00,NEP 2016 Roads' 
        ,'PR0001334MN,S01378MN,18188.00,18855.00,NEP 2016 Roads' 
        ,'PR0001334MN,S01378MN,18855.00,19752.00,NEP 2016 Roads' 
        ,'PR000177MN,S01378MN,17459.00,18188.00,NEP 2016 Roads' 
        ,'PR0001336MN,S00914MN,4145.00,4714.00,NEP 2016 Roads' 
        ,'PR0003148MN,S00914MN,3235.00,4340.00,NEP 2016 Roads' 
        ,'PR0001336MN,S00914MN,7121.00,7670.00,NEP 2016 Roads' 
        ,'PR0003148MN,S00914MN,7453.00,8558.00,NEP 2016 Roads' 
        ,'PR0001336MN,S00914MN,33464.00,34067.00,NEP 2016 Roads' 
        ,'PR0001336MN,S00914MN,34067.00,34264.00,NEP 2016 Roads' 
        ,'PR0001336MN,S00914MN,34610.00,34776.00,NEP 2016 Roads' 
        ,'PR0001336MN,S00914MN,34776.00,35522.00,NEP 2016 Roads' 
        ,'PR000182MN,S00914MN,34610.00,34776.00,NEP 2016 Roads' 
        ,'PR0001336MN,S00914MN,52714.00,53633.00,NEP 2016 Roads' 
        ,'PR000182MN,S00914MN,52714.00,53633.00,NEP 2016 Roads' 
        ,'PR0001336MN,S00914MN,54158.00,54590.00,NEP 2016 Roads' 
        ,'PR0001336MN,S00914MN,54590.00,54659.00,NEP 2016 Roads' 
        ,'PR0001336MN,S00914MN,54659.00,55462.00,NEP 2016 Roads' 
        ,'PR000182MN,S00914MN,54659.00,55462.00,NEP 2016 Roads' 
        ,'PR000182MN,S00914MN,55462.00,56004.00,NEP 2016 Roads' 
        ,'PR0001336MN,S00914MN,56592.00,57596.00,NEP 2016 Roads' 
        ,'PR000182MN,S00914MN,56592.00,57596.00,NEP 2016 Roads' 
        ,'PR0001352MN,S00908MN,5780.00,6380.00,NEP 2016 Roads' 
        ,'PR0006552MN,S00908MN,6180.00,6260.00,NEP 2016 Roads' 
        ,'PR0001353MN,S01011MN,3096.00,4430.00,NEP 2016 Roads' 
        ,'PR0005337MN,S01011MN,4245.00,5302.00,NEP 2016 Roads' 
        ,'PR0001364MN,S01006MN,235.00,506.00,NEP 2016 Roads' 
        ,'PR000190MN,S01006MN,506.00,1181.00,NEP 2016 Roads' 
        ,'PR0001364MN,S01006MN,7195.00,7299.00,NEP 2016 Roads' 
        ,'PR0001364MN,S01006MN,7299.00,7499.00,NEP 2016 Roads' 
        ,'PR0001370MN,S00997MN,1207.00,1590.00,NEP 2016 Roads' 
        ,'PR0003154MN,S00997MN,1207.00,1428.00,NEP 2016 Roads' 
        ,'PR0001407MN,S00519MN,57879.00,58138.00,NEP 2016 Roads' 
        ,'PR0001407MN,S00519MN,58138.00,58347.00,NEP 2016 Roads' 
        ,'PR0001407MN,S00519MN,59382.00,59805.00,NEP 2016 Roads' 
        ,'PR000201MN,S00519MN,59382.00,60102.00,NEP 2016 Roads' 
        ,'PR0001441MN,S00692MN,45.00,500.00,NEP 2016 Roads' 
        ,'PR0001441MN,S00692MN,500.00,1417.00,NEP 2016 Roads' 
        ,'PR0001445MN,S00392MN,2005.00,2659.00,NEP 2016 Roads' 
        ,'PR0003176MN,S00392MN,1971.00,2247.00,NEP 2016 Roads' 
        ,'PR000508MN,S00392MN,1671.00,2005.00,NEP 2016 Roads' 
        ,'PR0001447MN,S00446MN,6719.00,6756.00,NEP 2016 Roads' 
        ,'PR0001447MN,S00446MN,6756.00,6881.00,NEP 2016 Roads' 
        ,'PR0001451MN,S00439MN,15400.00,16333.00,NEP 2016 Roads' 
        ,'PR0005242MN,S00439MN,16333.00,17895.00,NEP 2016 Roads' 
        ,'PR0001451MN,S00439MN,71903.00,71927.00,NEP 2016 Roads' 
        ,'PR0001451MN,S00439MN,71927.00,71948.00,NEP 2016 Roads' 
        ,'PR0001498LZ,S00731LZ,17349.00,17741.00,NEP 2016 Roads' 
        ,'PR0001498LZ,S00731LZ,17741.00,17879.00,NEP 2016 Roads' 
        ,'PR00017LZ,S00731LZ,16749.00,17349.00,NEP 2016 Roads' 
        ,'PR0001498LZ,S00731LZ,64074.00,64120.00,NEP 2016 Roads' 
        ,'PR0001498LZ,S00731LZ,64120.00,64398.00,NEP 2016 Roads' 
        ,'PR0001498LZ,S00731LZ,64398.00,64588.00,NEP 2016 Roads' 
        ,'PR0001498LZ,S00731LZ,64588.00,64670.00,NEP 2016 Roads' 
        ,'PR0001519LZ,S01911LZ,639.00,1186.00,NEP 2016 Roads' 
        ,'PR00056LZ,S01911LZ,1186.00,2075.00,NEP 2016 Roads' 
        ,'PR000924LZ,S01911LZ,0.00,639.00,NEP 2016 Roads' 
        ,'PR0001520LZ,S01917LZ,0.00,767.00,NEP 2016 Roads' 
        ,'PR00059LZ,S01917LZ,767.00,1397.00,NEP 2016 Roads' 
        ,'PR0001523LZ,S04239LZ,4398.00,4464.00,NEP 2016 Roads' 
        ,'PR0001523LZ,S04239LZ,4464.00,5411.00,NEP 2016 Roads' 
        ,'PR000691LZ,S04239LZ,3760.00,4464.00,NEP 2016 Roads' 
        ,'PR0006029LZ,S04239LZ,4469.00,4519.00,NEP 2016 Roads' 
        ,'PR000153MN,S00647MN,14753.00,14954.00,NEP 2016 Roads' 
        ,'PR000153MN,S00647MN,14954.00,15500.00,NEP 2016 Roads' 
        ,'PR000153MN,S00647MN,17213.00,17722.00,NEP 2016 Roads' 
        ,'PR000153MN,S00647MN,17722.00,18243.00,NEP 2016 Roads' 
        ,'PR0001558LZ,S00319LZ,43678.00,46576.00,NEP 2016 Roads' 
        ,'PR0001558LZ,S00319LZ,46421.00,46576.00,NEP 2016 Roads' 
        ,'PR000314LZ,S00319LZ,46421.00,46940.00,NEP 2016 Roads' 
        ,'PR000794LZ,S00319LZ,46008.00,46421.00,NEP 2016 Roads' 
        ,'PR0001558LZ,S00319LZ,53338.00,53582.00,NEP 2016 Roads' 
        ,'PR0005403LZ,S00319LZ,53582.00,56617.00,NEP 2016 Roads' 
        ,'PR0001577LZ,S01030LZ,4952.00,6539.00,NEP 2016 Roads' 
        ,'PR0002934LZ,S01030LZ,4099.00,6539.00,NEP 2016 Roads' 
        ,'PR0001584LZ,S00967LZ,18953.00,19596.00,NEP 2016 Roads' 
        ,'PR0001584LZ,S00967LZ,19596.00,19956.00,NEP 2016 Roads' 
        ,'PR0001600LZ,S01372LZ,1190.00,1427.00,NEP 2016 Roads' 
        ,'PR000634LZ,S01372LZ,679.00,1190.00,NEP 2016 Roads' 
        ,'PR0001600LZ,S01372LZ,3654.00,4043.00,NEP 2016 Roads' 
        ,'PR000634LZ,S01372LZ,3240.00,3654.00,NEP 2016 Roads' 
        ,'PR0001602LZ,S01373LZ,120.00,183.00,NEP 2016 Roads' 
        ,'PR000638LZ,S01373LZ,183.00,327.00,NEP 2016 Roads' 
        ,'PR0001602LZ,S01373LZ,3441.00,3706.00,NEP 2016 Roads' 
        ,'PR000638LZ,S01373LZ,3241.00,3441.00,NEP 2016 Roads' 
        ,'PR000638LZ,S01373LZ,3706.00,3954.00,NEP 2016 Roads' 
        ,'PR0001611MN,S00621MN,0.00,108.00,NEP 2016 Roads' 
        ,'PR0005324MN,S00621MN,0.00,1226.00,NEP 2016 Roads' 
        ,'PR000161MN,S00621MN,7344.00,7461.00,NEP 2016 Roads' 
        ,'PR000161MN,S00621MN,7461.00,8318.00,NEP 2016 Roads' 
        ,'PR000161MN,S00621MN,30951.00,31458.00,NEP 2016 Roads' 
        ,'PR000161MN,S00621MN,31458.00,31962.00,NEP 2016 Roads' 
        ,'PR000161MN,S00621MN,31962.00,32369.00,NEP 2016 Roads' 
        ,'PR0001621MN,S00458MN,126.00,536.00,NEP 2016 Roads' 
        ,'PR0001621MN,S00458MN,536.00,678.00,NEP 2016 Roads' 
        ,'PR0001621MN,S00458MN,678.00,976.00,NEP 2016 Roads' 
        ,'PR0001621MN,S00458MN,1094.00,2005.00,NEP 2016 Roads' 
        ,'PR0001621MN,S00458MN,2005.00,2934.00,NEP 2016 Roads' 
        ,'PR0003177MN,S00458MN,76.00,2766.00,NEP 2016 Roads' 
        ,'PR0001679LZ,S01191LZ,1256.00,1395.00,NEP 2016 Roads' 
        ,'PR0001679LZ,S01191LZ,1395.00,1473.00,NEP 2016 Roads' 
        ,'PR0001679LZ,S01191LZ,1473.00,1623.00,NEP 2016 Roads' 
        ,'PR0001679LZ,S01195LZ,1806.00,2395.00,NEP 2016 Roads' 
        ,'PR0001679LZ,S01195LZ,2395.00,3301.00,NEP 2016 Roads' 
        ,'PR00049LZ,S01195LZ,3263.00,4204.00,NEP 2016 Roads' 
        ,'PR0001679LZ,S01195LZ,3321.00,3400.00,NEP 2016 Roads' 
        ,'PR0001679LZ,S01195LZ,3400.00,3460.00,NEP 2016 Roads' 
        ,'PR0001679LZ,S01195LZ,6380.00,6932.00,NEP 2016 Roads' 
        ,'PR0001679LZ,S01195LZ,6932.00,7015.00,NEP 2016 Roads' 
        ,'PR0001679LZ,S01195LZ,7015.00,7394.50,NEP 2016 Roads' 
        ,'PR0001679LZ,S01195LZ,7394.50,7533.50,NEP 2016 Roads' 
        ,'PR0001701LZ,S00731LZ,3875.00,4025.00,NEP 2016 Roads' 
        ,'PR0001701LZ,S00731LZ,4025.00,4210.00,NEP 2016 Roads' 
        ,'PR0001709LZ,S03784LZ,38456.00,38715.00,NEP 2016 Roads' 
        ,'PR0001710LZ,S03784LZ,38715.00,39107.00,NEP 2016 Roads' 
        ,'PR000170LZ,S04074LZ,18368.00,20368.00,NEP 2016 Roads' 
        ,'PR0004993LZ,S04074LZ,20368.00,22224.00,NEP 2016 Roads' 
        ,'PR0005254LZ,S04074LZ,17176.00,18588.00,NEP 2016 Roads' 
        ,'PR000172MN,S00926MN,18937.00,20221.00,NEP 2016 Roads' 
        ,'PR0003142MN,S00926MN,18040.00,19857.00,NEP 2016 Roads' 
        ,'PR000172MN,S00926MN,24225.00,25230.00,NEP 2016 Roads' 
        ,'PR000172MN,S00926MN,25230.00,26216.00,NEP 2016 Roads' 
        ,'PR000172MN,S00926MN,26216.00,26565.00,NEP 2016 Roads' 
        ,'PR0005809LZ,S00731LZ,16749.00,17249.00,NEP 2016 Roads' 
        ,'PR000188MN,S00957MN,39000.00,39807.00,NEP 2016 Roads' 
        ,'PR000188MN,S00957MN,39807.00,40346.00,NEP 2016 Roads' 
        ,'PR000194MN,S00476MN,0.00,389.00,NEP 2016 Roads' 
        ,'PR0005351MN,S00476MN,0.00,436.00,NEP 2016 Roads' 
        ,'PR000194MN,S00485MN,13643.00,14176.00,NEP 2016 Roads' 
        ,'PR000194MN,S00485MN,14176.00,15132.00,NEP 2016 Roads' 
        ,'PR000194MN,S00485MN,26370.00,26856.00,NEP 2016 Roads' 
        ,'PR000194MN,S00485MN,26856.00,27448.00,NEP 2016 Roads' 
        ,'PR000194MN,S00485MN,43155.00,43873.00,NEP 2016 Roads' 
        ,'PR000194MN,S00485MN,43873.00,44454.00,NEP 2016 Roads' 
        ,'PR000201MN,S00519MN,49332.00,49845.00,NEP 2016 Roads' 
        ,'PR000201MN,S00519MN,49417.00,49845.00,NEP 2016 Roads' 
        ,'PR000208MN,S00126MN,3127.00,3236.00,NEP 2016 Roads' 
        ,'PR000208MN,S00126MN,3236.00,3608.00,NEP 2016 Roads' 
        ,'PR000208MN,S00126MN,4907.00,5076.00,NEP 2016 Roads' 
        ,'PR000208MN,S00126MN,5076.00,5256.00,NEP 2016 Roads' 
        ,'PR000208MN,S00126MN,5345.00,5861.00,NEP 2016 Roads' 
        ,'PR0005062MN,S00126MN,0.00,5534.00,NEP 2016 Roads' 
        ,'PR00020LZ,S00760LZ,43365.00,43546.00,NEP 2016 Roads' 
        ,'PR00020LZ,S00760LZ,43546.00,43946.00,NEP 2016 Roads' 
        ,'PR000814LZ,S00760LZ,43946.00,44379.00,NEP 2016 Roads' 
        ,'PR000225MN,S00220MN,14036.00,14583.00,NEP 2016 Roads' 
        ,'PR000225MN,S00220MN,14583.00,14727.00,NEP 2016 Roads' 
        ,'PR000225MN,S00220MN,31804.00,32410.00,NEP 2016 Roads' 
        ,'PR000225MN,S00220MN,32410.00,32561.00,NEP 2016 Roads' 
        ,'PR000229MN,S00439MN,13928.00,14429.00,NEP 2016 Roads' 
        ,'PR0005242MN,S00439MN,9400.00,14429.00,NEP 2016 Roads' 
        ,'PR000231MN,S00421MN,1068.00,2142.00,NEP 2016 Roads' 
        ,'PR000231MN,S00421MN,2142.00,5561.00,NEP 2016 Roads' 
        ,'PR000236LZ,S05991LZ,11761.00,12685.00,NEP 2016 Roads' 
        ,'PR0005010LZ,S05991LZ,10269.00,12265.00,NEP 2016 Roads' 
        ,'PR000236LZ,S05991LZ,13249.00,14011.00,NEP 2016 Roads' 
        ,'PR000236LZ,S05991LZ,14011.00,14279.00,NEP 2016 Roads' 
        ,'PR000239LZ,S01313LZ,0.00,871.00,NEP 2016 Roads' 
        ,'PR000239LZ,S01313LZ,871.00,1290.00,NEP 2016 Roads' 
        ,'PR000239LZ,S01313LZ,12436.00,13293.00,NEP 2016 Roads' 
        ,'PR000239LZ,S01313LZ,13293.00,14123.00,NEP 2016 Roads' 
        ,'PR000248LZ,S05009LZ,8689.00,9585.00,NEP 2016 Roads' 
        ,'PR000248LZ,S05009LZ,9585.00,10503.00,NEP 2016 Roads' 
        ,'PR00024LZ,S00782LZ,6738.00,7487.00,NEP 2016 Roads' 
        ,'PR0005150LZ,S00782LZ,4036.00,6953.00,NEP 2016 Roads' 
        ,'PR0006LZ,S00782LZ,7487.00,8020.00,NEP 2016 Roads' 
        ,'PR00025LZ,S00857LZ,53514.00,54093.00,NEP 2016 Roads' 
        ,'PR00025LZ,S00857LZ,54093.00,54749.00,NEP 2016 Roads' 
        ,'PR00025LZ,S00857LZ,54093.00,54851.00,NEP 2016 Roads' 
        ,'PR000832LZ,S00857LZ,53246.00,53514.00,NEP 2016 Roads' 
        ,'PR0005825LZ,S00857LZ,54696.00,54746.00,NEP 2016 Roads' 
        ,'PR00025LZ,S00857LZ,59750.00,59805.00,NEP 2016 Roads' 
        ,'PR00025LZ,S00857LZ,59805.00,59815.00,NEP 2016 Roads' 
        ,'PR00025LZ,S00857LZ,60451.00,60760.00,NEP 2016 Roads' 
        ,'PR000832LZ,S00857LZ,60760.00,61099.00,NEP 2016 Roads' 
        ,'PR000278LZ,S03955LZ,1823.00,2502.00,NEP 2016 Roads' 
        ,'PR000278LZ,S03955LZ,2502.00,3060.00,NEP 2016 Roads' 
        ,'PR0003737LZ,S02043LZ,6502.00,11813.00,NEP 2016 Roads' 
        ,'PR0003738LZ,S02043LZ,11813.00,15813.00,NEP 2016 Roads' 
        ,'PR0003739LZ,S02057LZ,23667.00,25414.00,NEP 2016 Roads' 
        ,'PR0003742LZ,S02057LZ,25414.00,27476.00,NEP 2016 Roads' 
        ,'PR0003745LZ,S04252LZ,2562.00,6312.00,NEP 2016 Roads' 
        ,'PR0003746LZ,S04252LZ,6312.00,7562.00,NEP 2016 Roads' 
        ,'PR0003746LZ,S04252LZ,7562.00,8096.00,NEP 2016 Roads' 
        ,'PR0003746LZ,S04252LZ,8096.00,10717.00,NEP 2016 Roads' 
        ,'PR0003749LZ,S04252LZ,10717.00,12384.00,NEP 2016 Roads' 
        ,'PR0003749LZ,S04252LZ,12384.00,13096.00,NEP 2016 Roads' 
        ,'PR0003749LZ,S04252LZ,13096.00,16356.00,NEP 2016 Roads' 
        ,'PR0003752LZ,S04253LZ,5033.00,7533.00,NEP 2016 Roads' 
        ,'PR0003753LZ,S04253LZ,7533.00,9668.00,NEP 2016 Roads' 
        ,'PR0003756LZ,S04227LZ,14497.00,14949.00,NEP 2016 Roads' 
        ,'PR0003764LZ,S04227LZ,14949.00,15350.00,NEP 2016 Roads' 
        ,'PR000376LZ,S04312LZ,0.00,750.00,NEP 2016 Roads' 
        ,'PR000376LZ,S04312LZ,750.00,1610.00,NEP 2016 Roads' 
        ,'PR000376LZ,S04312LZ,1610.00,2393.20,NEP 2016 Roads' 
        ,'PR0003828MN,S01146MN,61016.00,64766.00,NEP 2016 Roads' 
        ,'PR0003829MN,S01146MN,64766.00,66016.00,NEP 2016 Roads' 
        ,'PR0003829MN,S01146MN,66016.00,68516.00,NEP 2016 Roads' 
        ,'PR0003831MN,S01146MN,68516.00,71016.00,NEP 2016 Roads' 
        ,'PR0003831MN,S01146MN,71016.00,72266.00,NEP 2016 Roads' 
        ,'PR0003833MN,S01146MN,72266.00,76016.00,NEP 2016 Roads' 
        ,'PR0003834MN,S01146MN,76016.00,79766.00,NEP 2016 Roads' 
        ,'PR0003835MN,S01146MN,79766.00,81016.00,NEP 2016 Roads' 
        ,'PR0003835MN,S01146MN,81016.00,83516.00,NEP 2016 Roads' 
        ,'PR0003837MN,S01146MN,83516.00,86016.00,NEP 2016 Roads' 
        ,'PR0003838MN,S01146MN,86016.00,89766.00,NEP 2016 Roads' 
        ,'PR0003839MN,S01146MN,89766.00,93292.00,NEP 2016 Roads' 
        ,'PR0003841MN,S01038MN,30137.00,30812.00,NEP 2016 Roads' 
        ,'PR0003849MN,S01038MN,30812.00,30901.00,NEP 2016 Roads' 
        ,'PR0003849MN,S01038MN,30901.00,31901.00,NEP 2016 Roads' 
        ,'PR0003849MN,S01038MN,31901.00,32338.00,NEP 2016 Roads' 
        ,'PR0003849MN,S01038MN,32542.00,32722.00,NEP 2016 Roads' 
        ,'PR0003849MN,S01038MN,32722.00,33442.00,NEP 2016 Roads' 
        ,'PR0003849MN,S01038MN,33454.00,34901.00,NEP 2016 Roads' 
        ,'PR0003849MN,S01038MN,34901.00,35697.00,NEP 2016 Roads' 
        ,'PR0003856MN,S01038MN,37816.00,37901.00,NEP 2016 Roads' 
        ,'PR0003856MN,S01038MN,37901.00,37994.00,NEP 2016 Roads' 
        ,'PR0003856MN,S01038MN,37994.00,38146.00,NEP 2016 Roads' 
        ,'PR0003856MN,S01038MN,38370.00,38870.00,NEP 2016 Roads' 
        ,'PR0003856MN,S01038MN,38870.00,39184.00,NEP 2016 Roads' 
        ,'PR0006502MN,S01038MN,39181.00,39341.00,NEP 2016 Roads' 
        ,'PR0003856MN,S01038MN,40901.00,41125.00,NEP 2016 Roads' 
        ,'PR0003865MN,S01038MN,41125.00,41324.00,NEP 2016 Roads' 
        ,'PR0003865MN,S01038MN,48419.00,48901.00,NEP 2016 Roads' 
        ,'PR0003865MN,S01038MN,48901.00,49008.00,NEP 2016 Roads' 
        ,'PR0003865MN,S01038MN,49944.00,50140.00,NEP 2016 Roads' 
        ,'PR0003876MN,S01038MN,50140.00,51146.00,NEP 2016 Roads' 
        ,'PR0003883MN,S01038MN,53980.00,54218.00,NEP 2016 Roads' 
        ,'PR0003883MN,S01038MN,54218.00,54901.00,NEP 2016 Roads' 
        ,'PR0003883MN,S01038MN,57150.00,57901.00,NEP 2016 Roads' 
        ,'PR0003883MN,S01038MN,57901.00,58901.00,NEP 2016 Roads' 
        ,'PR0003939MN,S01369MN,8871.00,9934.00,NEP 2016 Roads' 
        ,'PR0003944MN,S01369MN,9934.00,10220.00,NEP 2016 Roads')
AND pip.programid ='P_CO-ITTS-227_09172015_083200' 
ORDER BY a.projectid, 
         a.start_chainage, 
         a.end_chainage ASC;

使用IN并且没有嵌套选择。但是如果有的话,我没有纠正任何语法错误。

答案 2 :(得分:0)

感谢Laurent Fauvel,

以下是他的回答..

根据差异,完全相同的请求你的in子句只会有更少的行。例如,第一个请求,您将初始in子句的前10个值,第二个请求接下来的10个值,第三个请求下一个10 ....但我认为你可以减小语法的大小(请参阅有关pg.name的注释),更改数据库的配置可能只允许一个请求