MySQL Forums
Forum List  »  PHP

Re: Multiple selects in one statement
Posted by: Radu Enea
Date: February 14, 2021 10:09PM

I finnaly made it.

$query = " SELECT
-- OrderID,
DATE_FORMAT(OrderDate, '%d %M %Y (%a)') as dateCreated,
count(*) AS numbers,
sum(case when cart LIKE '%Click2call%' then 1 else 0 end) AS Click2call,
sum(case when cart LIKE '%freedom%' then 1 else 0 end) AS Freedom
FROM
new_orders
WHERE
(OrderDate BETWEEN '$substr' AND '$today')
GROUP BY
DAY(OrderDate)
ORDER BY
OrderDate DESC
";

Options: ReplyQuote


Subject
Written By
Posted
February 14, 2021 07:12AM
Re: Multiple selects in one statement
February 14, 2021 10:09PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.