Dear friends, I am developing a database application for our saleses with PHP and MySQL. Our sales must call the customers on time. They may not be late to call the customers. The may not miss the appointment to meet the customer on the telephone line. But I have a problem to implement the SQL query on MySQL DB Engine.
Suppose I have this simple table ("APPOINTMENT" Table) : CUSTID Cont_Pers APPOINTMENT_TIME 1 Albert 2002-10-23 13:00:00 2 Sarah 2002-10-24 14:00:00 3 Sandra 2002-10-23 08:00:00 ... ... ... ... ... ... I want to display one record which contain the appointment which has closest time between the current time ( "sysdate()" ) and the APPOINTMENT_TIME. So each the sales query one record (select) the record from this table with application than they will finf the record which has the earliest appointment time. I tried this SQL Query but it doesn't work : " SELECT * FROM Appointment WHERE MIN(sysdate()-appointment_time) GROUP BY CustID " Please tell me to determine the proper SQL Statement. Thank you very much in advance. __________________________________________________ Do you Yahoo!? Faith Hill - Exclusive Performances, Videos & More http://faith.yahoo.com --------------------------------------------------------------------- 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