mysql subquery (query for function parameter)
Posted on 2014-01-10
Not sure if this is ok to combine so many things...
If I have a table with columns:
the name "experts exchange" in firstname.
I want to search for the space, and put everything after into `lastname`. ie(firstname:experts lastname:exchange)
Logically, this is what I would want.
update table set `lastname` = substr(`firstname`, (SELECT instr(`firstname`, ' ') FROM table));
(even that though would include the space, so I would want instr + 1. Or I could do a second pass to remove the leading space afterwards....
Thanks in advance!