WaqasAhmed Posted January 21, 2016 Share Posted January 21, 2016 I have a table containing 6 records i want to display first four records today and today date should be saved against those 4 records.On the next day remaining two records should be displayed and first two records as well and date should be saved and flag should b incremented as well.i hope you guys are getting my point Quote Link to comment Share on other sites More sharing options...
requinix Posted January 22, 2016 Share Posted January 22, 2016 UPDATE table SET last_dty_timestamp = /* today's date */, duty_flag = duty_flag + 1 ORDER BY last_dty_timestamp ASC /* earliest records first */, person_id /* unique ID to guarantee a stable sort */ LIMIT 4 /* only update the first four records */ Quote Link to comment Share on other sites More sharing options...
WaqasAhmed Posted January 22, 2016 Author Share Posted January 22, 2016 UPDATE table SET last_dty_timestamp = /* today's date */, duty_flag = duty_flag + 1 ORDER BY last_dty_timestamp ASC /* earliest records first */, person_id /* unique ID to guarantee a stable sort */ LIMIT 4 /* only update the first four records */ i have done the same......but how i can update next day........next day remaining two should b updated.....and first two as well.. Quote Link to comment Share on other sites More sharing options...
requinix Posted January 22, 2016 Share Posted January 22, 2016 Are you saying that it does not work right now? Because that query says absolutely nothing about which day's records to update. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.