List:General Discussion« Previous MessageNext Message »
From:Tonu Samuel Date:August 22 2000 6:30am
Subject:Re: Dates and Queries
View as plain text  
Hunter Hillegas wrote:
> 
> Whoops...
> 
> I posed the wrong query below... Here is my query as it currently stands:
> 
> select *, if (status = 'Q', if(quote_expiration_date > NOW(),
> date_format(quote_expiration_date, '%M %D, %Y'), 'EXPIRED'),
> date_format(quote_expiration_date, '%M %D, %Y')) as expiration_date from
> order_line_master;
> 
> The nested ifs are causing problems... None of the rows returned have
> 'EXPIRED' in them, though some dates are from weeks ago...

You want to show "EXPIRED" on missed dates? Then your query is still
wrong! 

quote_expiration_date > NOW() gives you dates, later than now.

Check also the manual about asking questions. You haven't provided us
information about MySQL version and table structure. 

-- 
+----------------------------------------------------------------+
| TcX  ____  __     _____   _____  ___                           |
|     /*/\*\/\*\   /*/ \*\ /*/ \*\ |*|     Tõnu Samuel           |
|    /*/ /*/ /*/   \*\_   |*|   |*||*|     tonu@stripped        |
|   /*/ /*/ /*/\*\/*/  \*\|*|   |*||*|     Tallinn, Estonia      |
|  /*/     /*/  /*/\*\_/*/ \*\_/*/ |*|____                       |
|  ^^^^^^^^^^^^/*/^^^^^^^^^^^\*\^^^^^^^^^^^                      |
|             /*/             \*\                Developers Team |
+----------------------------------------------------------------+
Thread
Dates and QueriesHunter Hillegas21 Aug
  • Re: Dates and Queriespmax21 Aug
    • Re: Dates and QueriesHunter Hillegas21 Aug
      • Re: Dates and QueriesTonu Samuel21 Aug
Re: Dates and QueriesHunter Hillegas21 Aug
  • Re: Dates and QueriesTonu Samuel22 Aug