Reputation:
I have this my first query:
SELECT (Temperature) + 273.15 FROM tbl_Temperature;
(Temperature
is the column name and tbl_Temperature
is the table name.)
Data in database dbTemp
:
25,3
26,7
28,4
(This are Temperature in Celsius)
output
272,45
273,85
275,55
(this are temperature in Kelvin)
This is my second query:
SELECT MAX (Temperature) FROM tbl_Temperature;
Data in database dbTemp
:
25,3
26,7
28,4
Output
28,4
(This are Temperature in Celsius)
I want to combine these queries.
Data in database dbTemp
:
25,3
26,7
28,4
(This are Temperature in Celsius)
Desired output
272,45
273,85
275,55
max: 275,55
(This are temperature in Kelvin)
So what I want is that it shows the data in Kelvin
and the maximum in Kelvin
.
Upvotes: 3
Views: 75
Reputation: 14389
You simply need to do:
SELECT Temperature + 273.15 FROM tbl_Temperature;
UNION ALL
SELECT 'max: ' + cast(MAX (Temperature)+ 273.15 as nvarchar) FROM tbl_Temperature;
Upvotes: 3