Reputation: 341
I have two date columns from
and to
i want to query like
SELECT cast(E.From as varchar(20)) + ' to ' + cast(E.To as varchar(20)) DateRange,
E.Reason, L.Title as LeaveType
FROM employeeleave E
LEFT JOIN listitems L ON E.LeaveTypeID = L.ListItemID
and make a new column daterange
.
My query is not working.
How do i cast date values to varchar in mysql.
Upvotes: 0
Views: 386
Reputation: 64496
I guess you need concat
SELECT concat(E.From,' to ',E.To) DateRange,
E.Reason,
L.Title as LeaveType
from employeeleave E
LEFT JOIN listitems L ON E.LeaveTypeID = L.ListItemID
Upvotes: 1