LuckyBoyEver wrote: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
What you want to do seems strange. Is it just the first four records when "ORDER BY person_id DESC" ? I ask because a database does not really have a "first four records". You can SELECT records by many criteria and sort them ascending/descending by any field.
If that is that is really what you want to do, then maybe something like:
Code: Select all
UPDATE mytable SET duty_flag=duty_flag+1, last_dty_timestamp=NOW() ORDER BY person_id DESC LIMIT 4
It would be a better design to be able to SELECT the rows you want to update based on values in their fields.