Click here to Skip to main content
15,902,835 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have to insert one value from table1 to table2. mns i have city table and country table i have to add city_id,country_id in branch table where city_id,country_id is foreign key in branch table...
plz help me.
Posted
Comments
Prosan 22-Jun-12 0:57am    
have you use insert trigger?
[no name] 22-Jun-12 9:14am    
Help with what? There is no question stated here. What have you tried? What errors are you getting? Where is the code that demonstrates your problem?

1 solution

And what is the issue here?

Create a association table, define the foreign keys and once you have the mapping, insert them into the table.
Simple INSERT query - just be sure that the ID's for city and country exists in respective tables as they will be foreign keys here.
 
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