newphpcoder Posted March 29, 2012 Share Posted March 29, 2012 Hi.. I need help in concatenation. here is my code: SELECT (SUM(TIMESTAMPDIFF(DAY, chemicalweighing_dateEntry, NOW()))), (SUM(TIMESTAMPDIFF(HOUR, chemicalweighing_dateEntry, NOW()))) - (SUM(TIMESTAMPDIFF(DAY,chemicalweighing_dateEntry, NOW())) * 24) AS age_day FROM kanban_data; the output of this is: 57 204 they are separated in between two columns. I want to combine them in one column like this: 57 day(s) 204 hr(s) ago Thank you Link to comment https://forums.phpfreaks.com/topic/259916-need-help-in-concatenation/ Share on other sites More sharing options...
Muddy_Funster Posted March 29, 2012 Share Posted March 29, 2012 like this? SELECT CONCAT( (SUM(TIMESTAMPDIFF(DAY, chemicalweighing_dateEntry, NOW()))), 'day(s) ', ((SUM(TIMESTAMPDIFF(HOUR, chemicalweighing_dateEntry, NOW()))) - (SUM(TIMESTAMPDIFF(DAY,chemicalweighing_dateEntry, NOW())) * 24)), 'hr(s) ago' )AS age_day FROM kanban_data; Link to comment https://forums.phpfreaks.com/topic/259916-need-help-in-concatenation/#findComment-1332264 Share on other sites More sharing options...
fenway Posted March 31, 2012 Share Posted March 31, 2012 Duplicate topic - http://www.phpfreaks.com/forums/index.php?topic=356569.0. Link to comment https://forums.phpfreaks.com/topic/259916-need-help-in-concatenation/#findComment-1333016 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.