I want to create function and I need to get the results 2 columns and assign them to variables so I can use them again, but for some reason I can only get it to work if I run the select statement twice :
SELECT lng INTO @zlng FROM zipcodes WHERE zip=@z LIMIT 1;
SELECT lat INTO @zlat FROM zipcodes WHERE zip=@z LIMIT 1;
I get an “Undeclared variable: lat” error if I try this:
SELECT lng INTO @zlng, lat INTO @zlat FROM zipcodes WHERE zip=@z LIMIT 1;
Is there a way to do both into one statement? Thanks!