Excluding the first result

How would I write a query where the first row is not selected?

IE: SELECT * FROM table WHERE [exclude first result] ORDER BY title

Thanks E

Its for a drop down navigation menu. The first link in the group is assigned to the main nav and the ones beneath it are in the nested list.

The limit offset looks like it will work.

Thank You r937!


The way your question was worded you wanted whichever one was stored in the first spot in the database (in whatever random order they are in) to be skipped since a where clause runs before the order. A limit does run after the order and so would skip the first one after they have been sorted.

With that structure though you’d only be able to store the one list in the table. To be able to store more than one list you’d need a field to identify what list the entry belonged to and could use that in the where clause to extract the particular entries you want.

Why would you want to skip the first row? Since the where clause is processed before the order by you do not know which row of data is contained in the first row.

To omit a specific row you are best to test something that you know is in that particular row and not in any of the other rows (and then negate the test so that it finds all the rows that don’t match).

So if the first title were known to be ‘WARTS’ then you’d use

SELECT * FROM table WHERE title <> ‘WARTS’ ORDER BY title

or you can use != instead of <> with mySQL

SELECT columns FROM daTable ORDER BY somecolumn LIMIT 1,9999999


SELECT columns FROM daTable
WHERE somecolumn > ( SELECT MIN(somecolumn) FROM daTable )
ORDER BY somecolumn