MYSQL get all results but first [duplicate]
Possible Duplicate:
Mysql Offset Infinite rows
I am trying to get all results for a query BUT NOT the first one, I have the following but its giving me an error, please help; thanks.
SELECT 开发者_运维百科DISTINCT `memberID` FROM `discusComments`
WHERE `topicID` = 4 ORDER BY `id` DESC OFFSET 1
SELECT DISTINCT `memberID`
FROM `discusComments`
WHERE `topicID` = 4
ORDER BY `id`
DESC limit 1,x
where x is a number enough great to contain all your records.
or use, instead of x, 18446744073709551615, that is maximum value of bigint unsigned.
Ignore the first row when you receive the results in your application. It is much neater than using an ugly query like:
SELECT * FROM my_table LIMIT 1, 18446744073709551615
Getting one extra row will not really hurt your performance.
精彩评论