I need to get value from specific data in my_table in MariaDB and store it into variables @var1 and @var2. In SQL Server I use :
Select @var1=field1 ,@var2=field2 from my_table where id=@varid...
What is the correct syntax for MariaDB or My SQL?
CodePudding user response:
The equal sign compares left and right value and returns 1 (true)/0 (false) or NULL if one of the values is NULL.
To assign a value to a variable use :=
:
SELECT @var1:=field1 ,@var2:=field2 from my_table where id=@varid