让我举个例子……我不能在 php 中创建这个视图(而我可以在 phpmyadmin 中)
$sql="CREATE VIEW ratings.rtgemissfitch AS
SELECT derivedtable. ISIN
FROM
(SELECT ISIN, MAX(Date_Notation_Emission) FROM ratings.ratingsemissionfitch as derivedtable GROUP BY ISIN) ";
但我可以在 php 中做到这一点:
$sql="CREATE VIEW ratings.rtgemissfitch AS
(SELECT ISIN, MAX(Date_Notation_Emission) FROM ratings.ratingsemissionfitch as derivedtable GROUP BY ISIN) ";
我真的不明白..首先,对不起我的英语,我是法国人..我真的不明白为什么在 phpadmin 上运行的请求在我的 php 代码中不起作用..probaby派生表...所以,我希望获得最后的评分 Fitch:phpmyadmin 中的 SQL 请求完美运行:
SELECT `DBFITCH`.`ISIN`, `RATING_FITCH`as FITCH_RTG
FROM
(SELECT `ISIN`, MAX(`RATING_DATE`) as LastUpdate
FROM `ratings`.`ratingsemissionfitch` GROUP BY ISIN) as LAST
INNER JOIN `ratings`.`ratingsemissionfitch` as DBFITCH
ON
DBFITCH.`ISIN`= LAST.`ISIN`
AND DBFITCH.`RATING_DATE`=LAST.LastUpdate
在 php 中,以下代码无法运行:
$sql="CREATE VIEW ratings.rtgemissfitch AS
SELECT DBFITCH.ISIN, RATING_FITCH as FITCH_RTG
FROM
(SELECT ISIN, MAX(RATING_DATE) as LastUpdate
FROM ratings.ratingsemissionfitch GROUP BY ISIN) as LAST
INNER JOIN ratings.ratingsemissionfitch as DBFITCH
ON
DBFITCH.ISIN= LAST.ISIN
AND DBFITCH.RATING_DATE=LAST.LastUpdate";
$req = $bdd->exec($sql);
让我再举一个例子……
我无法在 php 中创建此视图(而我可以在 phpmyadmin 中)
$sql="CREATE VIEW ratings.rtgemissfitch AS
SELECT derivedtable. ISIN
FROM
(SELECT ISIN, MAX(Date_Notation_Emission) FROM ratings.ratingsemissionfitch as derivedtable GROUP BY ISIN) ";
但我可以在 php 中做到这一点:
$sql="CREATE VIEW ratings.rtgemissfitch AS
(SELECT ISIN, MAX(Date_Notation_Emission) FROM ratings.ratingsemissionfitch as derivedtable GROUP BY ISIN) ";
我真的不明白..提前谢谢,