Hello.


What version of MySQL do you use? On my 5.0.11 I have a correct result:



mysql> show create table dateTest\G;

*************************** 1. row ***************************

       View: dateTest

                         Create View: CREATE ALGORITHM=UNDEFINED VIEW 
`test`.`dateTest` AS

                         select sql_no_cache `test`.`tDay`.`theDate` AS

                         `theDate`,`test`.`tDay`.`a` AS `a` from `test`.`tDay` 
where

                         (`test`.`tDay`.`theDate` > (now() - interval 1 day))





                         



[EMAIL PROTECTED] wrote:

> I have a table with date values:

> 

> +------------+

> | theDate    |

> +------------+

> | 2005-08-15 |

> | 2005-08-16 |

> | 2005-08-14 |

> +------------+

> 

> I can execute this select statement on it:

> 

>   select * from tDay where theDate > date_sub( now(), interval 1 day);

> 

> And I can create a view from it:

> 

>   create view dateTest as  select * from tDay where theDate >  

> date_sub( now(), interval 1 day);

> 

> On creating the view, the date_sub function is replaced by its result,  

> though, so that the view does not generate dynamic results:

> 

>   show create table dateTest;

>   CREATE ALGORITHM=UNDEFINED VIEW `kurse`.`dateTest` AS select  

> sql_no_cache `kurse`.`tDay`.`theDate` AS `theDate` from

>   `kurse`.`tDay` where (`kurse`.`tDay`.`theDate` > 20050814)

> 

> How can I avoid this replacement and make this view a truly dynamic one?

> 

> s.m.

> 



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Gleb Paharenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.NET
       <___/   www.mysql.com




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to