Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to select from table MariDB

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?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

The equal sign compares left and right value and returns true/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
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading