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 Quote Link to comment 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()? Quote Link to comment 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 Quote Link to comment 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 Quote Link to comment 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 . . . 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.