Reputation: 113976
I need to fetch a scalar value of the MySQL VARIABLE "version". Currently running this:
SHOW VARIABLES WHERE Variable_name="version"
Is giving me a table like:
Variable_name Value
------------- -----------
version 5.5.28-log
How do I just get the Value cell?
Upvotes: 1
Views: 96
Reputation: 3809
set @x = select @@version;
That will set the user variable @x with the current version.
If you want it in a straight select, use
select @@version;
This generalizes - most system variables are available using the @@ syntax.
Upvotes: 1
Reputation: 113976
Okay, I found out how:
select variable_value
from information_schema.global_variables
where variable_name = 'version';
Upvotes: 0