Link to home
Start Free TrialLog in
Avatar of Tanabe Saori
Tanabe SaoriFlag for Japan

asked on

How do I update 3 columns using multiple selects as expressions

I'm just trying to update three columns based on a backup table.
I'm trying this but it doesn't work. As far as I can tell, it doesn't like something within the (). I've run those separately and they work fine.
update worksheet2 
SET `cascade-order` = (select `cascade-order` from worksheet_bak where sid = 56 ORDER BY wid DESC LIMIT 1;),
SET `cascade-name` = (select `cascade-name` from worksheet_bak where sid = 56 ORDER BY wid DESC LIMIT 1;),
SET levels = (select levels from worksheet_bak where sid = 56 ORDER BY `worksheet_bak`.`WID` DESC LIMIT 1;)
WHERE sid = 56 and sub = 'nums';

Open in new window

Right now I'm just trying to do this within phpmyadmin console. Later I'll take the working solution and run it through PHP.
Thanks for any help
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Tanabe Saori

ASKER

The only thing I had to change is removing ; from each select statement.