heinetz: You can't specify target table 'waregroups' for update in FROM

Beitrag lesen

hi,

für's archiv:

ich habe mit folgendem SQL-Statement ein Problem:

INSERT INTO waregroups ( id , values_id , position )

VALUES (
'', 182, (

SELECT IFNULL( MAX( t.position ) +1, 1 ) AS pos
FROM waregroups AS t
)
)

  
das half:  
  
~~~sql
INSERT INTO `waregroups` ( `id` , `values_id` , `position` )  
SELECT '', 182, (  
  
SELECT IFNULL( MAX( t.`position` ) +1, 1 )  
FROM `waregroups` AS t  
)

gruesse,
heinetz