SELECT t1.priority, t1.today, COALESCE(t2.yesterday, 0) AS yesterday
FROM
(SELECT priority, COUNT(*) AS 'today' FROM ... WHERE time >= '2021-06-03 00:00:00' AND time <= '2021-06-03 23:59:59' GROUP BY priority) t1
LEFT JOIN
(SELECT priority, COUNT(*) AS 'yesterday' FROM ... WHERE time >= '2021-06-03 00:00:00' AND time <= '2021-06-03 23:59:59' GROUP BY priority) t2
ON (t1.priority = t2.priority);
@Column({
type: 'date',
name: 'time'
})
time: string;
/**
* Force date types (TIMESTAMP, DATETIME, DATE) to be returned as strings rather then inflated into JavaScript Date objects.
* Can be true/false or an array of type names to keep as strings.
*/
readonly dateStrings?: boolean | string[];
SELECT dialogs.id_dialog AS id, clients.name AS name, SUM(case when messages.status = 0 then 1 else 0 end) AS qt
FROM dialogs INNER JOIN clients ON dialogs.id_client = clients.id_client INNER JOIN
messages ON dialogs.id_dialog = messages.id_dialog WHERE dialogs.id_manager = '1' GROUP BY dialogs.id_dialog
$query = mysql_query("INSERT INTO orders_in_shop (id_client, price_order, status, data_order) VALUES ('$id_client','$price','$status', '$data')");
$id_order_in_shop = mysql_insert_id();