Click here to Skip to main content
15,914,943 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
INSERT INTO Food (FoodID, FoodName, ItemID, ItemName) Select DISTINCT FoodID, FoodName, ItemID, ItemName from Food f CROSS JOIN Item i
Posted
Updated 7-Feb-14 18:46pm
v2

Correct me if i am wrong. You write
INSERT INTO 
Food (FoodID, FoodName, ItemID, ItemName)
which will give error as you haven't supplied any value
 
Share this answer
 
SQL
INSERT INTO 
Food (FoodID, FoodName, ItemID, ItemName)
SELECT DISTINCT FoodID, FoodName, ItemID, ItemName
FROM Item;
 
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