I have written a code to update few row values of a column. And it does gets updated everytime.
And the updated rows are retrieved successfully.
The query used for getting updated rows is as follows
SELECT * FROM `Employee` WHERE `K` = '" .$selected_dropdown. "' ORDER BY `Employee`.`Age` DESC
But i want to sort the updated rows based on the row values and when i sort the row values the unupdated rows are also getting sorted out...
Is there any way to get only the updated rows and the sorted values of the updated rows, ignore the unupdated rows of the same column?
NOTE: COMMAND GAVE ME ALL UPDATED ROWS (uisng DESC) but i want to SORT THE VALUES OF UPDATED ROWS and ignore the unupdated rows
Example:
i get some values like after using the above query
row1 51.25
row2 26.25
row3 81.9
Now row1 and row2 is updated and and row3 is unupdated So, ignoring that unupdated row3 value, i want to sort the values of updated row1 and row2 values in ascending order...
the output must be like
row2 26.25
row1 51.25
I'm not fully sure what you're after, but can't you SELECT
these values before UPDATE
, do desired logic with them, save the IDs or each row and run UPDATE table_name SET col = 'new_value' WHERE id IN ($ids)
.
If you have logics for updating the values, then you should be able to use the same to retrieve them before UPDATE
and sort with whatever value you like.