Reputation: 21
How to do I query this in?
Graph is working on this query
$dataPoints = array();
$result = mysqli_query($conn, "SELECT * FROM service_booking GROUP BY service_id");
while($row = mysqli_fetch_array($result))
{
$point = array("label" => $row['service_id'] , "y" => $row['booking_id']);
array_push($dataPoints, $point);
}
but I want the "label" $row['service_id']
display as a ['services']
coming from a different parent table.
services (tbl1) service_booking (tbl2)
services || service_id service_id || booking id
Upvotes: 2
Views: 86
Reputation: 780889
Join the tables
SELECT b.*, s.services
FROM service_booking AS b
JOIN services AS s ON s.service_id = b.service_id
Upvotes: 1