The SQL query in my PHP file is
SELECT start_time,end_time FROM data;
This returns the two varchar fields in two different columns. Now i wish to combine these. So I tried
Select start_time+' '+end_time as time from data;
This returns some numeric value. So I tried:
Select cast(start_time+' '+end_time) as time from data;
If the data in my table is start_time = 8:00 a.m end_time = 9:30 a.m
how can I display 8:00 a.m - 9:30 a.m.
Select CONCAT(start_time, ' - ', end_time) as time FROM data
You're looking for CONCAT()
.
SELECT CONCAT(start_time, ' ', end_time) AS time FROM data;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With