Srinath A.
2008-Sep-02 07:17 UTC
SQL - Merging fields from two tables into one, including dup
Hi, I have two tables, nutritions and food_options. nutritions has two fields, fooditem_id, taken and . food_options has two fields, fooditem_id and taken. fooditem_id in nutritions and food_options will point to id in food_items table(third table). I want to select all records from nutritions and food_options into a new table, C with Fields fooditem_id and taken. This means I need to combine the values of fooditem_id in nutritions and fooditem_id in food_options into one field (fooditem_id), including the duplicates in both tables. EX: nutritions id fooditem_id taken 1 23 1 2 23 1 food_options id fooditem_id taken 1 34 1 C id fooditem_id taken 1 23 1 2 23 1 3 34 1 How can I do this? thanks, srinath -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---