I have created a before insert trigger when new value insert as it's item\_sku already exits then delete already exit line and then insert new line. but it shows error:
**Error Code: 1442
Can't update table 'order\_item\_temp' in stored function/trigger because it is already used by statement which invoked this stored function/trigger**
Trigger Code is

```
    TRIGGER LINE_DEL AFTER INSERT ON order_item_temp 
    FOR EACH ROW 
    BEGIN

    DECLARE ITEM_D VARCHAR(50);

     SELECT item_sku INTO @ITEM_D
        FROM order_item_temp
         GROUP BY  item_sku,shopify_order_id
        HAVING  COUNT(item_sku) > 1;

     DELETE FROM order_item_temp WHERE item_sku=@item_d;

    END;
$$

DELIMITER ;

```

and by manual entry entering new duplicate line syntax is:

*INSERT INTO ehad\_db.order\_item\_temp (
id,
item\_sku,
item\_uid,
item\_sid,
item\_qty,
document\_item\_sid,
document\_item\_row\_version,
ref\_order\_item\_sid,
ref\_order\_item\_row\_version,
item\_discount\_amt,
item\_discount\_code,
item\_discount\_type,
item\_discount\_target,
shopify\_order\_id,
order\_document\_sid,
ref\_order\_sid
)
VALUES
(
'89',
'1000000009574',
'517662213000115019',
'32000000306430',
'1',
'582945547000174220',
'1',
' ',
' ',
'0',
' ',
' ',
' ',
'1903931129956',
'582945544000151211',
' ');*

now it shows above error.