I want to get sale stats day by day and count which section sold how much.
I'm really confused about "EVERYTHING".
$em = $this->getEntityManager()->getConnection();
$stmt = $em->prepare("
SELECT
COUNT(o.id) AS `all`,
(
SELECT COUNT(id) FROM order_panoramic_orders WHERE DAY(created_at) = DAY(NOW()) AND status_id NOT IN (7,9)
) AS `day`
FROM
order_panoramic_orders as o
WHERE
status_id NOT IN (7,9)
");
I can get daily stats but i have no idea how to deal with section seperation.
The results must be as much as like this:
Day: 1 - Total: 10 - Section1: 3, Section2: 5, Section3: 2
Any idea?
By th way;
Section and user tables are seperated.
I have to join these two tables, i guess.
First table: orders Second table: users Third table: sections