含义:您不能在子句中为更新指定目标表'xxx'。

错误描述:删除语句中直接含select,如下:

DELETE FROM meriadianannotation WHERE
    SeriesID IN (    
        SELECT
            SeriesID as tid
        FROM
            meriadianannotation
        GROUP BY
            SeriesID
        HAVING
            count(SeriesID) > 1
)
AND data NOT IN (
    SELECT
        min(data) as bid
    FROM
        meriadianannotation
    GROUP BY
        SeriesID
    HAVING
        count(SeriesID) > 1
)

 解决方法:加临时表,如下,

DELETE FROM meriadianannotation WHERE
    SeriesID IN (    
select t.tid from(
        SELECT
            SeriesID as tid
        FROM
            meriadianannotation
        GROUP BY
            SeriesID
        HAVING
            count(SeriesID) > 1
    ) t    
)
AND data NOT IN (
select b.bid from(
    SELECT
        min(data) as bid
    FROM
        meriadianannotation
    GROUP BY
        SeriesID
    HAVING
        count(SeriesID) > 1
) b
)

 

相关文章:

  • 2021-09-12
  • 2021-06-28
  • 2021-12-12
  • 2022-01-08
  • 2022-12-23
  • 2021-06-20
  • 2021-06-14
猜你喜欢
  • 2022-12-23
  • 2021-12-30
  • 2022-12-23
  • 2021-07-01
  • 2022-01-12
  • 2021-05-20
  • 2021-10-24
相关资源
相似解决方案