I have a LOG table that has a filed named "folder_reset". If it's equal to 1, then the folder has been reset.
A folder gets reset when a user clicks a button (button_id). A reset button can reset multiple folder_id's.
I built a refernce table named "folder_reset" that links button_ids with the folder_ids that they will reset.
So, when the button_id 300 is clicked, I want the LOG TABLE to look like this:
The UPDATE part of the query would look like:
UPDATE log
SET fodler_reset = 1 WHERE order_id = 2000
AND...
And the SELECT part of the query would look like:
SELECT folder_id
FROM log_reset
WHERE button_id = 300
However, I have no idea how to do an UPDATE... SELECT statement. Any advice would be much appreciated!
Thanks in advance!
-Jeff
"Grace... She travels outside of Karma"
-U2
A folder gets reset when a user clicks a button (button_id). A reset button can reset multiple folder_id's.
I built a refernce table named "folder_reset" that links button_ids with the folder_ids that they will reset.
Code:
LOG TABLE
---------
log_id order_id folder_id folder_reset
1 2000 1 0
2 2000 2 0
3 2000 3 0
LOG_RESET TABLE
---------------
reset_id button_id folder_id
1 300 1
2 300 2
So, when the button_id 300 is clicked, I want the LOG TABLE to look like this:
Code:
LOG TABLE
---------
log_id order_id folder_id folder_reset
1 2000 1 1
2 2000 2 1
3 2000 3 0
The UPDATE part of the query would look like:
UPDATE log
SET fodler_reset = 1 WHERE order_id = 2000
AND...
And the SELECT part of the query would look like:
SELECT folder_id
FROM log_reset
WHERE button_id = 300
However, I have no idea how to do an UPDATE... SELECT statement. Any advice would be much appreciated!
Thanks in advance!
-Jeff
"Grace... She travels outside of Karma"
-U2