版主,我在网上找到一个,帮我看看:
表1 id(主键,自增),editer_id,title,context
表2 id(主键,自增),apply_id(外键,关联表1的主键,非自增),apply_type,applyer_id
INSERT INTO t_editarticle (editer_id,article_id,title,context) VALUES(1,1,'ww','ee') DECLARE @ID INT SELECT @ID = SCOPE_IDENTITY() INSERT INTO t_check (apply_id,apply_type,applyer_id) VALUES(@ID,1,1)
网上这样教,可是我试了一下,报错的:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DECLARE @ID INT SELECT @ID = SCOPE_IDENTITY() INSERT INTO t_check (apply_id,appl' at line 1