sql - MySQL query involving cross join, uniqueness, etc -
Thankfully, I have not had to work specifically before complex SQL queries. This is my goal.
 I have a table  ham , which I would like to join with table  egg  - that is, all ham-Egg combinations ... to an extent . 
  Egg  has a specialty  how_cooked  in the table, which is  ENUM ('over-the-easy', 'bottom', 'cache') .  I have to list with a sample egg in combination with all kinds of combination with us and egg-cooking method as a result.  (I do not particularly care about which eggs.) 
 So if the cooking method of 1, 2, and 3, and 3 eggs of   I'm sure I can unite some solutions with the weight of the subcategories here and there, but is there a great way to do this, MySQL?  id  Hmmm with code> should result in something like this:   
  + --------- + ---------------- - + --------- + | Hams.id | Eggs.how_cooked | Eggs.id | + --------- + ----------------- + --------- + | 1 | Easier | 1 | | 1 | Fried 4 | | 1 | Frantically 7 | | 2 | Easier | 1 | | 2 | Fried 4 | | 2 | Frantically 7 | | 3 | Easier | 1 | | 3 | Fried 4 | | 3 | Frantically 7 | + --------- + ----------------- + --------- +  
Through a little bit of real hard and googling thinking, I can find a good solution:
  hams from SELECT *, hams.id by eggs group, egg .how_cooked   does it work? Is it really easy?
Comments
Post a Comment