Click here to Skip to main content
15,914,111 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
in my project "food ordering system,i have order table,bill table and food table.The fields of order table are : order_id,food_id,food_quantity.The fields of food table are : food_id,food_name,food_price.The fields of bill table are : bill_id,order_id,food_id.

how can i write a stored procedure to generate a bill using these table data?
Posted

1 solution

Hello,

You can use LEFT JOIN to retrieve the necessary item wise data.
SQL
SELECT b.bill_id, b.order_id, b.food_id, f.food_name, f.food_price, o.food_quantity FROM bill_table b LFFT JOIN food_table f ON f.food_id = b.food_id LEFT JOIN order_table o ON o.order_id = b.order_id


Regards,
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900