I have another idea that can be more performante than the solution given in my last include question : solution of question And this is my suggestion but it doesn't work!
SELECT
32,
57,
'MVT/15/12/0001',
'BSR/15/12/001',
'S',
'ART_039',
'AAAA',
a.qte_art,
1,
a.qte_art - 1,
'uuuu'
INTO mvt(id_piece, article_id_article, code_mvt, origine_mvt, type_mvt, code_art, des_art, qte_old, qte_mvt, qte_new, link_piece)
FROM article a
WHERE a.id_article = 57
#1327 - Undeclared variable: mvt
Please chek my question in the link because the resean i tried this solution is that i have a trigger on mvt table
I think you should use insert into table(fields) select fields from xxx
You must set Insert Section first then do the selecting... The query should look something like this:
INSERT INTO courses (name, location, gid)
SELECT name, location, 1
FROM courses
WHERE cid = 2
The format to insert int to table using select is
INSERT INTO table_name1 (field_1, field_2, field3)
SELECT field_1, field_2, field_3 from table_name2
For Your case give us
Insert into mvt(id_piece, article_id_article, code_mvt, origine_mvt, type_mvt, code_art, des_art, qte_old, qte_mvt, qte_new, link_piece)
SELECT
32,
57,
'MVT/15/12/0001',
'BSR/15/12/001',
'S',
'ART_039',
'AAAA',
a.qte_art,
1,
a.qte_art - 1,
'uuuu' FROM article a
WHERE a.id_article = 57