nomadsoul Posted September 8, 2011 Share Posted September 8, 2011 Hi all, I've found many explanations on how to calculate the difference between two individual dates i.e: DATEDIFF (day, ‘7/8/2009’, ‘8/14/2009’) AS Result ] But nothing on how to calculate the difference between two date fields i.e: SELECT DATEDIFF(ShippedDate,RequiredDate) AS NewCalculatedField I tried but won't work, can it be done? -tried with and without parenthesis Link to comment https://forums.phpfreaks.com/topic/246676-date-difference-betwee-columns/ Share on other sites More sharing options...
Pikachu2000 Posted September 8, 2011 Share Posted September 8, 2011 What about it doesn't work? Are there errors returned from mysql_error()? Link to comment https://forums.phpfreaks.com/topic/246676-date-difference-betwee-columns/#findComment-1266683 Share on other sites More sharing options...
nomadsoul Posted September 8, 2011 Author Share Posted September 8, 2011 #1054 - Unknown column 'ShippedDate' in 'field list' But there is a ShippedDate column Link to comment https://forums.phpfreaks.com/topic/246676-date-difference-betwee-columns/#findComment-1266685 Share on other sites More sharing options...
nomadsoul Posted September 8, 2011 Author Share Posted September 8, 2011 Sorry I am a complete dumbass, I forgot the tablename. SELECT DATEDIFF(ShippedDate,RequiredDate) AS DiffDate FROM Orders Link to comment https://forums.phpfreaks.com/topic/246676-date-difference-betwee-columns/#findComment-1266686 Share on other sites More sharing options...
Pikachu2000 Posted September 8, 2011 Share Posted September 8, 2011 If that's the actual query string you're trying to use, it would need to contain a FROM clause . . . Link to comment https://forums.phpfreaks.com/topic/246676-date-difference-betwee-columns/#findComment-1266688 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.