troubleshooting Question

How do I update 3 columns using multiple selects as expressions

Avatar of Tanabe Saori
Tanabe SaoriFlag for Japan asked on
PHPMySQL Server
2 Comments1 Solution11 ViewsLast Modified:
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
Éric Moreau
Senior .Net Consultant
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros