Rumah > pembangunan bahagian belakang > tutorial php > sqlserver - 同一句sql在php里执行没有结果,在navicat里查询有结果是什么原因?

sqlserver - 同一句sql在php里执行没有结果,在navicat里查询有结果是什么原因?

WBOY
Lepaskan: 2016-06-06 20:23:53
asal
1466 orang telah melayarinya

如题,同一句sql在php里执行没有结果,在navicat里查询有结果。

<code>SELECT
    TOP 25 SHANGPIN.SPDM,
    SHANGPIN.SPMC,
    GUIGE1.GGMC AS YS,
    SUM (VW_SDLSMX.SL) AS SL,
    FJSX3.SXMC AS SHEJI,
    FJSX4.SXMC AS DABAN
FROM
    SHANGPIN,
    GUIGE1,
    GUIGE2,
    VW_SDLSMX,
    FJSX3,
    FJSX4
WHERE
    VW_SDLSMX.SPDM = SHANGPIN.SPDM
AND VW_SDLSMX.GG1DM = GUIGE1.GGDM
AND VW_SDLSMX.GG2DM = GUIGE2.GGDM
AND VW_SDLSMX.DM1 != '900'
AND VW_SDLSMX.DM1 != '901'
AND SHANGPIN.FJSX3 = FJSX3.SXDM
AND SHANGPIN.FJSX4 = FJSX4.SXDM
AND 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.SXMC
ORDER BY
    SUM (SL) DESC</code>
Salin selepas log masuk
Salin selepas log masuk

回复内容:

如题,同一句sql在php里执行没有结果,在navicat里查询有结果。

<code>SELECT
    TOP 25 SHANGPIN.SPDM,
    SHANGPIN.SPMC,
    GUIGE1.GGMC AS YS,
    SUM (VW_SDLSMX.SL) AS SL,
    FJSX3.SXMC AS SHEJI,
    FJSX4.SXMC AS DABAN
FROM
    SHANGPIN,
    GUIGE1,
    GUIGE2,
    VW_SDLSMX,
    FJSX3,
    FJSX4
WHERE
    VW_SDLSMX.SPDM = SHANGPIN.SPDM
AND VW_SDLSMX.GG1DM = GUIGE1.GGDM
AND VW_SDLSMX.GG2DM = GUIGE2.GGDM
AND VW_SDLSMX.DM1 != '900'
AND VW_SDLSMX.DM1 != '901'
AND SHANGPIN.FJSX3 = FJSX3.SXDM
AND SHANGPIN.FJSX4 = FJSX4.SXDM
AND 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.SXMC
ORDER BY
    SUM (SL) DESC</code>
Salin selepas log masuk
Salin selepas log masuk

是不是没有 commit

打印出你的sql语句看下,可能传值的时候要加引号。如:变量='$...';

之前也遇到同样的情况,当时把语句复制到window s的记事本,再复制粘贴回回去,居然就好了。

Label berkaitan:
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan