'convert minutes to hh:mm when datediff includes one datetime and another conversion of two string values to datetime

Example: THEN DATEDIFF(minute, o.abc,CONVERT(DATETIME,o.def + ' ' + o.ghi))

this gives the count of minutes as '322'.

o.abc is a datetime type o.def and o.ghi are string values

I need to convert the minutes result to hh:mm.

Tried this, and it's close THEN CONVERT(varchar(5), DATEADD(minute,DATEDIFF(minute, o.abc,CONVERT(DATETIME,o.def + ' ' + o.ghi)),0),114) but the error is "Conversion failed when converting the varchar value'05:22' to data type int."

How do I get hh:mm, please? Thank you.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source