From: Graeme B. Davis Date: March 15 1999 2:26pm Subject: Sql Query question List-Archive: http://lists.mysql.com/mysql/255 Message-Id: <01be6eef$d273dc00$9927253f@norway.corp.us.uu.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Basically I am trying to accomplish an if statement in my sql query.  I want to do one query Tuesday-Friday and then another query Monday. Here are two separate queries: Tuesday-Friday: --------------- select assignedto, count(assignedto) as count from openedstats where modified <= DATE_SUB(now(),INTERVAL 2 DAY) group by assignedto order by count desc; Monday query: ------------- select assignedto, count(assignedto) as count from openedstats where modified <= DATE_SUB(now(),INTERVAL 4 DAY) group by assignedto order by count desc; This is all I have come up with so far, but I don't know how to integrate this into the select: mysql> select if(strcmp(dayname(now()),"Monday"),"2","4"); +---------------------------------------------+ | if(strcmp(dayname(now()),"Monday"),"2","4") | +---------------------------------------------+ | 4                                           | +---------------------------------------------+ (I did this query on Monday, so it returned "4", which corresponds to the above queries "INTERVAL X DAY" Any hints, ideas? Thanks!