mysql - How should I write this query? -
i want show rows except last 2 id. have tried:
select f.* failed_order_emailids f id not in (select id failed_order_emailids order id desc limit 2)
this giving following error:
this version of mysql doesn't yet support 'limit & in/all/any/some subquery'
select f.* failed_order_emailids f left join (select id failed_order_emailids order id desc limit 2) last2 on last2.id = f.id last2.id null
you use this:
select f.* failed_order_emailids f f.id < ( select min(id) ( select id failed_order_emailids order id desc limit 2) last2 )
Comments
Post a Comment