I am having a hard time understanding subqueries. I am pretty sure that is what I need to accomplish my task, but not sure how to put it together.
I have a unique ID field that auto-increments, so that a new entry always gets a higher number assigned to that ID field.
What I want to do is leave X amount of newer entries out, and order by zipcode (new entries means not retrieved/printed). For example, if there are 64 entries that we have not retrieved to print, we want to retrieve the oldest 60 entries and order them by zipcode.
Something like:
select x,y,z from tbl_address order by zipcode ASC from (select x,y,z from tbl_address where retrieved <> 1 order by ID ASC limit 0,60)