Alternative to using LIMIT keyword in a SubQuery in MYSQL

前端 未结 4 1474
没有蜡笔的小新
没有蜡笔的小新 2020-11-29 09:06

I have a table TEST with the following columns :

code_ver (VARCHAR)
suite (VARCHAR)
date (DATE)

Now I want to select 10 rows with a distin

4条回答
  •  独厮守ぢ
    2020-11-29 09:43

    You can also use same query, just by adding one extra layer of select before subquery. and that's it. It will work.

    select * from test 
    where code_ver IN (select * from (select DISTINCT code_ver 
                          from test 
                         where code_ver NOT LIKE '%DevBld%' 
                         ORDER by date DESC LIMIT 10) as t1);
    

提交回复
热议问题