我的MySQL查询有什么问题,如果执行该查询,我只会得到1行,但是指定表中有很多数据。表中有很多重复的OAno,我想选择最新的ID。
SELECT * FROM hct_info_oa WHERE OAno IN (SELECT * FROM (SELECT DISTINCT OAno FROM hct_info_oa ORDER BY hct_id_po DESC LIMIT 1) as t1) LIMIT 50
表hct_info_oa
hct_id_po | 1 | 2 | 3 | 4 | 5
OAno ------ || 266 | 266 | 266 | 522 | 522
预期输出:
hct_id_po | 3 | 5
OAno ------ | 266 | 522