mysql 子查询限制备选
mysql subquery limit alternative
我想 select 与我最近的 200 条记录不同。所以我为此写了查询
select
distinct(server_ip)
FROM
resource_monitor where server_ip IN
(SELECT server_ip FROM resource_monitor ORDER BY id DESC LIMIT 0, 200
)
但是这显示错误
this version of mysql doesn't yet support 'limit & in/all/any/some subquery'
此查询的备选方案是什么?
select distinct t1.server_ip
from (select server_ip from resource_monitor ORDER BY id DESC LIMIT 200) as t1;
我想 select 与我最近的 200 条记录不同。所以我为此写了查询
select
distinct(server_ip)
FROM
resource_monitor where server_ip IN
(SELECT server_ip FROM resource_monitor ORDER BY id DESC LIMIT 0, 200
)
但是这显示错误
this version of mysql doesn't yet support 'limit & in/all/any/some subquery'
此查询的备选方案是什么?
select distinct t1.server_ip
from (select server_ip from resource_monitor ORDER BY id DESC LIMIT 200) as t1;