开发者

How can i get DATA from TIME?

i have the table NAMES

and i've the following register on this table

NAME='Jose'
PASSWD='Maria'
POINTS='2000'
TIMESTAMP='2011-03-17 21:16:17' //field tipe TIMESTAMP

and another register

NAME='Pedro'
PASSWD='Paulo'
POINTS='4000'
TIMESTAMP='2011-02-16 00:00:00'

if i made the query like this

SELECT N开发者_如何学GoOME FROM NAMES WHERE TIMESTAMP < '2011-03-17'

this query will return only the NAME "Pedro", because his TIMESTAMP are smaller than data that i put in the query (2011-03-17)

but what i want is..

Let's imagine what in the day 15/03 Jose has 2000 points, and in the day 16/03 he has 5000 points. How do i know how many points he has in the day 15/03 on today (18/03)?. This MySQL field tipe "TIMESTAMP" will return to me only registers that was updated before the query data, but this is not what i want.

What i want is take the value X that their field has in the day Y.


select nome from names where date(timestamp) = '2011-03-15';
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜