如題,同一句sql在php裡執行沒有結果,在navicat裡查詢有結果。
SELECT TOP 25 SHANGPIN.SPDM, SHANGPIN.SPMC, GUIGE1.GGMC AS YS, SUM (VW_SDLSMX.SL) AS SL, FJSX3.SXMC AS SHEJI, FJSX4.SXMC AS DABANFROM SHANGPIN, GUIGE1, GUIGE2, VW_SDLSMX, FJSX3, FJSX4WHERE VW_SDLSMX.SPDM = SHANGPIN.SPDMAND VW_SDLSMX.GG1DM = GUIGE1.GGDMAND VW_SDLSMX.GG2DM = GUIGE2.GGDMAND VW_SDLSMX.DM1 != '900'AND VW_SDLSMX.DM1 != '901'AND SHANGPIN.FJSX3 = FJSX3.SXDMAND SHANGPIN.FJSX4 = FJSX4.SXDMAND VW_SDLSMX.SPDM IN ( SELECT SPDM FROM SHANGPIN WHERE BYZD4 = '000' AND BYZD5 = 'eg')GROUP BY SHANGPIN.SPDM, SHANGPIN.SPMC, GUIGE1.GGMC, FJSX3.SXMC, FJSX4.SXMCORDER BY SUM (SL) DESC
回複內容:
如題,同一句sql在php裡執行沒有結果,在navicat裡查詢有結果。
SELECT TOP 25 SHANGPIN.SPDM, SHANGPIN.SPMC, GUIGE1.GGMC AS YS, SUM (VW_SDLSMX.SL) AS SL, FJSX3.SXMC AS SHEJI, FJSX4.SXMC AS DABANFROM SHANGPIN, GUIGE1, GUIGE2, VW_SDLSMX, FJSX3, FJSX4WHERE VW_SDLSMX.SPDM = SHANGPIN.SPDMAND VW_SDLSMX.GG1DM = GUIGE1.GGDMAND VW_SDLSMX.GG2DM = GUIGE2.GGDMAND VW_SDLSMX.DM1 != '900'AND VW_SDLSMX.DM1 != '901'AND SHANGPIN.FJSX3 = FJSX3.SXDMAND SHANGPIN.FJSX4 = FJSX4.SXDMAND VW_SDLSMX.SPDM IN ( SELECT SPDM FROM SHANGPIN WHERE BYZD4 = '000' AND BYZD5 = 'eg')GROUP BY SHANGPIN.SPDM, SHANGPIN.SPMC, GUIGE1.GGMC, FJSX3.SXMC, FJSX4.SXMCORDER BY SUM (SL) DESC
是不是沒有 commit
列印出你的sql語句看下,可能傳值的時候要加引號。如:變數='$...';
之前也遇到同樣的情況,當時把語句複製到window s的記事本,再複製粘貼回回去,居然就好了。