-2

Let me please show an other example ... I can't be able to create this view in php (whereas i can in 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) ";

But i can do this in php :

$sql="CREATE VIEW ratings.rtgemissfitch AS
(SELECT ISIN, MAX(Date_Notation_Emission) FROM ratings.ratingsemissionfitch as derivedtable GROUP BY ISIN) ";

I really don't understand..First of all, sorry for my english, i'm french.. I really don't understand why the request, which runs on phpadmin, doesn't work in my php code..probaby the derivated table... So, i'm looking to get the last rating Fitch : The SQL request in phpmyadmin which works perfectly:

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 

In php, the following code wich doesn't run :

$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);

Let me please show an other example ...

I can't be able to create this view in php (whereas i can in 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) ";

But i can do this in php :

$sql="CREATE VIEW ratings.rtgemissfitch AS
(SELECT ISIN, MAX(Date_Notation_Emission) FROM ratings.ratingsemissionfitch as derivedtable GROUP BY ISIN) ";

I really don't understand.. Thanks in advance,

1 Answers1

0

your database user probably doesnt have privilege to run

CREATE VIEW

?

djjjuk
  • 368
  • 1
  • 2
  • 14