以下MS SQL查询在MS SQL Management Studio中正常工作,但在PHP中没有。我没有收到任何错误,但mssql_num_rows
返回0。
查询:
SELECT
S.LS,
S.IstWADatum,
S.Gesamtmenge,
SUM(T.Gesamtmenge) as GesamtmengeT,
SUM(PP.Gesamtmenge) as GesamtmengePP
FROM
dbo.SAPREPORT AS S
LEFT JOIN dbo.TRACE AS T
ON S.LS = T.LSNR
LEFT JOIN dbo.PKSPLUS AS PP
ON S.LS = PP.LSNR
WHERE
(S.Warenempfaenger = '1'
OR S.Warenempfaenger = '2'
OR S.Warenempfaenger = '3'
OR S.Warenempfaenger = '4'
OR S.Warenempfaenger = '5' )
AND S.IstWADatum = '12.03.2015'
GROUP BY
S.LS,
S.IstWADatum,
S.Gesamtmenge
Studio中的结果集是
LS IstWADatum Gesamtmenge GesamtmengeT GesamtmengePP
xxx 2015-03-12 14 NULL NULL
xxx 2015-03-12 1 NULL NULL
xxx 2015-03-12 4 NULL NULL
xxx 2015-03-12 4 NULL NULL
xxx 2015-03-12 5 NULL NULL
xxx 2015-03-12 23 NULL NULL
xxx 2015-03-12 43 NULL NULL
由于