I want to get the highest value in the last 1 day, but the query is not working.
(date / time columns formatted by date).
The data I want to query is in multiple headers.
SELECT sign, date, price, MAX(price) as maxp FROM table WHERE datetime >= NOW() - INTERVAL 1 DAY
my full query;
$que = $conn->mysql_query("SELECT sign, date, MAX(price) as maxp FROM table WHERE date >= (NOW() - INTERVAL 1 DAY) group by sign, date");
$row = mysql_fetch_array($que); {
?>
<?php
foreach ($que as $row) {
$newQuery = "UPDATE tableb SET `daymax`='".$row["maxp"]."' where `sign`='".$row["sign"]."' ";
mysqli_multi_query($conn, $newQuery)
?>
My Answer:
>= DATE_SUB(NOW(), INTERVAL 1 DAY) GROUP BY sign;
Rate this post
4 of 5 based on 9760 votesComments