How to put data from multiple rows into one row array in MySQL -


Suppose I have a table day for breakfast and dinner for each day The meal specifies the food ID which points to a table food in which food names are included. How do I get breakfast and dinner meals using a single question? Actually I want to add the following to a query:

  SELECT days *, Food.name AS breakfast_name From day to day, where food is from .breakfast_id = food.id and days.id = '12 'SELECT days. *, Food.name is the name of the food as a day of eating, from day to day, where food is, day, day, double, food, food, and day. Id = '12'.  

You can do this in a single query by connecting twice to the food table on individual IDs.

  SELECT days. *, Join the meal as BF Day, as Bf name AS breakfast_name, df.name, as the BF day from the day of the night. Breakfast_id = bf.id Include food as dd on days.dinner_id = df.id ;  

Comments

Popular posts from this blog

winforms - C# Form - Property Change -

java - Messages from .properties file do not display UTF-8 characters -

javascript - amcharts makechart not working -