Sqlserver-why does the same SQL statement have no results in php?

Source: Internet
Author: User
For example, if the same SQL statement is executed in php and there is no result in navicat. {Code...}: if the same SQL statement is executed in php, no results are returned. The results are queried in 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

Reply content:

For example, if the same SQL statement is executed in php and there is no result in 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

Is there no commit?

Print out your SQL statement and check that quotation marks are required when values are passed. For example, variable = '$ ...';

I encountered the same situation before. At that time, I copied the statement to the notepad of window s and copied and pasted it back.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.