So I'd like it to be something like, or have the effect of:
declare vFN varchar(20);
declare vLN varchar(20);
set vFN, vLN = (select fname, lname from sometable where id = 1);
Obviously, I could do 2 selects, but that seems very inefficient.
tia
you should try
declare vFN varchar(20);
declare vLN varchar(20);
select fname, lname INTO vFN, vLN from sometable where id = 1;
check http://dev.mysql.com/doc/refman/5.0/en/select-into.html for documentation.
Have two set statements. Set one with the select statement and then copy the value in the first to the second.
declare vFN varchar(20);
declare vLN varchar(20);
set vFN = (select fname, lname from sometable where id = 1);
set vLN = vFN;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With