I have a deals table with the following data:
dealID | date | followUP | user
1 |2012-10-15 | Yes |
2 |2012-12-24 | Yes |
3 |2013-01-05 | |
4 |2013-02-02 | Yes |
5 |2013-02-02 | Yes |
And a users table with my users list
userID | name
1 | john
2 | eric
3 | anne
What I would like to do is to query the first table that has followUP set as 'YES' then from the result assign a user to them in sequence from the users table so my final deals table will look like this
dealID | date | followUP | userID
1 |2012-10-15 | Yes | 1
2 |2012-12-24 | Yes | 2
3 |2013-01-05 | |
4 |2013-02-02 | Yes | 3
5 |2013-02-02 | Yes | 1
I know its a loop but for some reason i cant figure out how to setup the second loop to assign the value of the users. Any help would be appreciated.
followUP = 'Yes'in sequential order based on theuserID?userIDin the "user" table is not auto incremental??