Hi, It is perfect, I was thinking of doing it in php but the solution that I've had was no way optimal. Thank you very much for the help.
Best regards and have a nice week-end, Cristi Stoica [EMAIL PROTECTED] wrote:
Hi Cristi, Look at this : mysql> select now(); +---------------------+ | now() | +---------------------+ | 2005-09-02 23:15:21 | +---------------------+ 1 row in set (0.00 sec) mysql> select DATE_ADD(now(), INTERVAL -1 DAY); +----------------------------------+ | DATE_ADD(now(), INTERVAL -1 DAY) | +----------------------------------+ | 2005-09-01 23:15:27 | +----------------------------------+ 1 row in set (0.00 sec) mysql> select date_format(now(),'%a'); +-------------------------+ | date_format(now(),'%a') | +-------------------------+ | Fri | +-------------------------+ 1 row in set (0.01 sec) So your query should be similar to : Select * from tbl where status='2' and date <= DATE_ADD(now(), INTERVAL -1 DAY) and date_format(date, '%a') in ('Mon', 'Tue', ...,'Fri'); Hope that helps Mathias -----Original Message----- From: inferno [mailto:[EMAIL PROTECTED] Sent: vendredi 2 septembre 2005 22:58 To: mysql@lists.mysql.com Subject: querry problem ( datetime => Monday - Sunday ) Hi, I have a problem: I need to make a select for data that was entered more than 24 hours ago, but in that 24 hours I have to count only Monday - Friday since that is the working program, and does not have the status = '2' ( Solved ) and the problem is that I sincerly do not know how. Any help/suggestions are apreciated since I am just a beginner. Best regards, Cristi Stoica P.S.: to give you a little idea on what I am using: ( the interface is coded in PHP for the users ) MySQL 4.0.24 and the the data looks like this: +------------------------+---------------------+------+-----+---------------------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------------------+---------------------+------+-----+---------------------+----------------+ | id | int(25) unsigned | | PRI | NULL | auto_increment | | client_name | varchar(100) | | | | | | code | bigint(13) | | | 0 | | | status | varchar(13) | | | 0 | | | date | datetime | | | 0000-00-00 00:00:00 | | +------------------------+---------------------+------+-----+---------------------+----------------+ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]