开发者

MYSQL get all results but first [duplicate]

This question already has answers here: Closed 11 years ago.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜