On 20 Nov 2002, at 15:30, Felipe D. Ramalho wrote: > Sorry, but I've omitted part of the where clause to make the message shorter > and now I see that it was important. Here goes the select again: > > SELECT A.cod_call, A.cod_link, A.nr_call , A.status, > B.dthr_occurrence as open, > DATE_SUB(C.dthr_occurence, INTERVAL B.dthr_occurrence HOUR_MINUTE) AS > during, > DATE_SUB(D.dthr_occurrence, INTERVAL B.dthr_occurrence HOUR_MINUTE) > AS late
I don't see that the WHERE clause is relevant. The problem is with the types of the arguments you're giving to DATE_SUB(). It appears from your query that dthr_occurrence is a DATETIME column, so it's appropriate to use it as the first argument to DATE_SUB(). However, the expression in the second argument is supposed to be a string indicating an interval. In this case, since you've said "HOUR_MINUTE", MySQL is expecting a string giving a number of hours and a number of minutes. Instead you're giving it something like '2002-11-20 12:54:43', which is not hours and minutes, so you get a NULL result. You have to give it something like '12:54', or whatever interval it is you're trying to subtract. -- Keith C. Ivey <[EMAIL PROTECTED]> Tobacco Documents Online http://tobaccodocuments.org Phone 202-667-6653 --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php