How to select all rows of a mysql table without last N(any integer value) rows.
I have tried
SELECT * FROM
chat
WHERE chat_id NOT IN(
SELECT chat_id FROM chat ORDER BY date_time DESC LIMIT 5
);
But it gives following error
This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
I am getting current MySQL version as following
mysql> SHOW VARIABLES LIKE 'version';
+---------------+------------------+
| Variable_name | Value |
+---------------+------------------+
| version | 5.1.33-community |
+---------------+------------------+