0

我有一个这样的查询来知道哪些行被更新:

update addresses set
last_checked_at  = now(),
where check_with = 'A'
and (SELECT @selectedAddresses :=  CONCAT_WS(',',id,@selectedAddresses))
order by last_checked_at  asc
limit 1;

当我运行此查询时,它返回超过 1。但是当我更改为:

 order by id asc

它只返回一个。我该如何解决这个问题?

id    address    last_checked_at  
1      abcd   2021-02-01 00:01:002
2      cdef    2021-02-01 00:01:002
3      fsde    2021-02-01 00:01:002

返回值:

1,2,3

只有更新的行是 1,我只想有 1 但是1,2,3

4

0 回答 0