Hello everyone, this is my first post. (sorry about the english). Thank you if you there can help. It would be also nice if you tell me that it is impossible to get just one query.
Q: IS IT ANAWAY POSSIBLE TO CONNECT THESE 2 QUERIES IN -> 1 QUERY?
QUERY 1:
[php]
SELECT event.*,
COUNT(reservation.Event_Id)
FROM event
LEFT JOIN reservation On Event_Id = E_Id
WHERE eStatus = ‘EVENTS’
GROUP BY E_Id
[/php]
QUERY 2:
[php]
SELECT SUM(need.nNeed)
FROM need
JOIN group ON need.G_Id = group.G_Id
GROUP BY E_Id
[/php]
TABLES:
event
- E_Id
reservation
- Event_Id
need
- E_Id
- G_Id
- eNeed
group
G_Id
So there are events and people want to get reservations for events.
-
Query echos events + counts reservations
-
Query brins amount of reservations