0
+---------+    +-----------+   +---------+
| USER    |    | USER_LANG |   | LANG    |
| id_user |    | id_user   |   | id_lang |
| name    |    | id_lang   |   | name    |
|         |    | years     |   |         |
+---------+    +-----------+   +---------+

I want to write query for saving data from user and user_lang in database at same time...is there some insert join or what?

John
  • 17
  • 1
  • 5

3 Answers3

0

No there isn't. You can only select or delete from multiple tables at once.

juergen d
  • 201,996
  • 37
  • 293
  • 362
0

If table structure would have been same; it would have been possible. But in your case you will have to use multiple queries. If you want to ensure integrity between table data then use Stored Procedures.

Mayur Manani
  • 795
  • 4
  • 12
0

try this

   INSERT INTO LANG (id_lang,name) 
   VALUES    (SELECT ul.id_lang ,u.name 
              FROM `USER` u
              INNER JOIN `USER_LANG` ul 
              ON  u.id_user = ul.id_user 
              )
echo_Me
  • 37,078
  • 5
  • 58
  • 78