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
.
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;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.