0

I am trying this query to get some records:

select *
from `inbox`
where (
`user_id` = '00000000000000000000000000000001'
or `user_id` = '' 
and exists (
    select * 
    from `inbox_user` 
    where `inbox_user`.`inbox_id` = `inbox`.`id` 
    and `user_id`= '00000000000000000000000000000001'
))
order by inactive_percentage DESC

This gives me back this result:

Result without limiting

As soon as I add limit 10 to the end it gives me this result:

Result after limiting

This doesn't make sense to me at all. According to me I should have ids 256 - 2560 but limiting changes the result and gives me the results from the end of the table. What is going on here? I tried top also but it says syntax error. How do I work around this?

Blank
  • 12,308
  • 1
  • 14
  • 32
Rohan
  • 13,308
  • 21
  • 81
  • 154

0 Answers0