How do I fetch data from 2 tables and display into 1 chartjs

0👍

You seem to be looking for a join:

SELECT f.name, fd.available_quantity 
FROM food_details fd
INNER JOIN food f on f.id = fd.id
ORDER BY fd.id

This query retrieves the name of each id from the food table, and puts it in the first column instead of the id. Rows are still ordered by id – you can change that to name if that’s what you want.

Leave a comment