Hello.




You said that you had created a view, but you continued using Tab_A

instead of Tab_A_View in your next queries. Did you want to use view

Tab_A_View? On my MySQL 5.0.9 all queries works both with view and

original table. See:



mysql> desc Tab_A;

+----------------+------------+------+-----+---------+-------+

| Field          | Type       | Null | Key | Default | Extra |

+----------------+------------+------+-----+---------+-------+

| datetime_field | datetime   | NO   |     |         |       |

| num_field      | bigint(20) | NO   |     |         |       |

+----------------+------------+------+-----+---------+-------+



mysql> desc Tab_A_View;

+----------------+------------+------+-----+---------------------+-------+

| Field          | Type       | Null | Key | Default             | Extra

|

+----------------+------------+------+-----+---------------------+-------+

| datetime_field | datetime   | NO   |     | 0000-00-00 00:00:00 |

|

| num_field      | bigint(20) | NO   |     | 0                   |

|

+----------------+------------+------+-----+---------------------+-------+



mysql> Select datetime_field, num_field from Tab_A_View where

datetime_field='2005-03-10' and        num_field = 1234;

+---------------------+-----------+

| datetime_field      | num_field |

+---------------------+-----------+

| 2005-03-10 00:00:00 |      1234 |

| 2005-03-10 00:00:00 |      1234 |

+---------------------+-----------+



mysql> Select datetime_field, num_field from Tab_A where

datetime_field='2005-03-10' and        num_field = 1234;

+---------------------+-----------+

| datetime_field      | num_field |

+---------------------+-----------+

| 2005-03-10 00:00:00 |      1234 |

| 2005-03-10 00:00:00 |      1234 |

+---------------------+-----------+











[EMAIL PROTECTED] wrote:

> Hello everyone,

>    I cannot figure this out. I have a table like the following:

> 

> Tab_A

> datetime_field  datetime not null,

> num_field  bigint not null

> 

> I do a SELECT as follows:

> 

> Select datetime_field, num_field from Tab_A

> where datetime_field='2005-03-10' and 

>      num_field = 1234;

> 

> I return 2 rows correctly.

> 

> I then create the view:

> 

> Create view Tab_A_View as 

> select * from Tab_A;

> 

> I do a SELECT as follows:

> 

> Select datetime_field, num_field from Tab_A

> where datetime_field='2005-03-10' and 

>      num_field = 1234;

> 

> 0 rows returned!

> 

> HOWEVER, IF I do the query as such:

> 

> Select datetime_field, num_field from Tab_A

> where datetime_field='2005-03-10 00:00:00' and 

>      num_field = 1234;

> 

> 2 rows returned correctly. Is there an implementation difference?

> 

> Regards,

> George

> 

> 

> 

> __________________________________________________________________

> Switch to Netscape Internet Service.

> As low as $9.95 a month -- Sign up today at http://isp.netscape.com/register

> 

> Netscape. Just the Net You Need.

> 

> New! Netscape Toolbar for Internet Explorer

> Search from anywhere on the Web and block those annoying pop-ups.

> Download now at http://channels.netscape.com/ns/search/install.jsp

> 



-- 
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