itemprop = "text">
Can you help me with SQL queries? I have this problem: I have two tables
"join" table: reservation_aus_mil
+ ---------------- + | ID_Resation | | Id_meal | | Pieces | + ---------------- +
and table with data: food
+ ---------- - - + | Id_meal | | Name | Sample data for + ------------- +
Food: 1 | Carrot 2 | Potato 3 | Cucumber reservation_heass_most 1 | 2 | 5230 1 3 | 1203
How do I get this result for reservation with id_reservation = 1:
id_meal | ID_Saving | Name | PC | -------------------------------------------- 1 | 1 | Carrots | Weak | 2 | 1 | Potato | 5230 | 3 | 1 | Cucumber 1203 | --------------------------------------------
And results for id_reservation = 2:
Thanks for the advice.
Check
id_reservation = 1
P > id_meal, id_Reervation, name, select food as PC, mL as Aianelanelel (Aidi_arrgn, 1) select as Aidi_arjeshens, in pieces as the PC, where Aidi_aiml from Arkshit_has_mel Aidi_reseshn = 1) RM on rm.id_meal = ml.id_meal
id_reservation =
to 2 from id_meal, id_Reservation, named as mL food Choose as pc ml.id_meal externally left (select a Switch to IFNULL (id_Reervation, 2) as id_Reservation, in pieces as the PC, where reservation_has_meal the id_meal id_reservation = 2) rm.id_meal = ml.id_meal on rm
That You Need Replace with the value Id_reservation assume that you are using to search
Comments
Post a Comment