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 Quote Link to comment 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; Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.