(One table) insert rows

前端 未结 1 1565
无人及你
无人及你 2021-01-23 00:38

This question is the continuation of this one.

I have the following table egr:

+---------+------------+
|  offid  |  groupid   |
+---------+         


        
相关标签:
1条回答
  • 2021-01-23 01:21

    This may be easier to achieve using the except operator:

    INSERT INTO egr (offid, groupid)
    SELECT 2, groupid
    FROM   egr
    WHERE  offid = 1
    EXCEPT
    SELECT 2, groupid
    FROM   egr
    WHERE  offid = 2
    
    0 讨论(0)
提交回复
热议问题