The query from my previous post was only part of a larger query. This is the entire query: SELECT GREATEST( IF( CURDATE( ) >= DATE_SUB( DATE( FROM_UNIXTIME( 1239508800 ) ) , INTERVAL LEAST( 14, ( SELECT COUNT( * ) FROM `verse_of_the_day_Bible_verses` WHERE seasonal_use =1 ) ) DAY ) AND CURDATE( ) <= DATE( FROM_UNIXTIME( 1239508800 ) ) , 1, 0 ) , IF( CURDATE( ) >= DATE_SUB( DATE( 2009 -12 -25 ) , INTERVAL LEAST( 14, ( SELECT COUNT( * ) FROM `verse_of_the_day_Bible_verses` WHERE seasonal_use =2 ) ) DAY ) AND CURDATE( ) <= DATE( 2009 -12 -25 ) , 2, 0 ) ) AS verse_application The result should be a "2". I am getting a 0. When I try the first subquery / IF statement the error message is: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF( CURDATE( ) >= DATE_SUB( DATE( FROM_UNIXTIME(1239508800) ) , INTERVAL LEAST( ' The error message for the Christmas check which should be giving me a "2" result is: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF( CURDATE( ) >= DATE_SUB( DATE( 2009 -12 -25 ) , INTERVAL LEAST( 14, ( SELE' at line 1 Any help out there please? Ron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php