Requête pour recuperer derniére valeur NOT NULL
Posté : 17 déc. 2023, 20:15
Bonjour,
Je souhaite récupérer dans une BDD la derniére valeur non null de la colonne pm25
J'ai essayé avec cette requête mais j'ai toujours un retour d'erreur
Je souhaite récupérer dans une BDD la derniére valeur non null de la colonne pm25
J'ai essayé avec cette requête mais j'ai toujours un retour d'erreur
voici la requêteFatal error: Uncaught mysqli_sql_exception: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE pm25 IS NOT NULL' at line 1 in /storage/ssd4/987/21478987/public_html/esp-database.php:126 Stack trace: #0 /storage/ssd4/987/21478987/public_html/esp-database.php(126): mysqli->query() #1 /storage/ssd4/987/21478987/public_html/esp-weather-station.php(102): getLastReadingsnotnull() #2 {main} thrown in /storage/ssd4/987/21478987/public_html/esp-database.php on line 126
Code : Tout sélectionner
$sql = "SELECT pm25 FROM SensorData ORDER BY id desc limit 10 WHERE pm25 IS NOT NULL";