Ok - I think this one is for the hard core MySQL'ers.....
I got two tables, COMPANY and CALLINGLIST.
The CALLINGLIST is a list of companies that a sales person is to
call. The list contains all the companies a sales person have been
given, but only displays the companies that has not been called.
Let's just say that there is a status flag called 'Called' / 'Not Called'.
The COMPANY table contains e.g. 50.000 companies.
Now, when the sales person has called all 10 companies, 10 new
companies from the COMPANY table is put into the CALLINGLIST.
PROBLEM STATEMENT
I need to go through the Company list and pick 10 new companies
to be put into the Callinglist, which has yet not ben given to any
sales persons. (I compare the two lists)
How can I only get 10 companies from a select statement?
It won't work using the LIMIT function, because the LIMIT function
starts from a position and reads ALL rows to a given number.
That means if a list has the orgID's 20,30,40 and 50, and they all
have been signed to a sales person, and the list gets updated
with new companies with the numbers 25,35,45 and 55, I would
need to pick these new companies and not just continue counting
from where I ended last time.
Sure I could put new companies last in the list, but I would like to
have the list sorted after company ID's.
Does anyone have a clue what I'm trying to say?? 🙂