我收到了一个 MySQL 查询:
SET @COD_PAIS = 3, @ID_CARTERA = 8;
SELECT
C.DES_PERMADURACION AS Item
, B.POR_MADURACION AS Percentage_Distribution
FROM dficha_mes A
JOIN det_maduraciones B
ON ( A.ID_FICHA_MES = B.ID_FICHA_MES )
JOIN mpermaduraciones C
ON ( B.ID_PERMADURACION = C.ID_PERMADURACION )
WHERE A.ID_CARTERA = @ID_CARTERA
AND A.COD_PAIS = @COD_PAIS
AND B.F_CORTE = (
SELECT
F_ULT_CIERRE_MENSUAL
FROM mpaises
WHERE COD_PAIS = @COD_PAIS );
该表有西班牙文的行和列。
当我使用 PHP 运行此查询时mysql_query()
,我收到以下错误:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT
C.DES_PERMADURACION AS Item
, B.POR_MADURACION AS Percentage_Distrib' at line 2
然而,这个查询可以在 MySQL Workbench 甚至 SQLYog 上完美运行。
这里有任何指示吗?