How select all records exact x days ago ?

How select all records exact x days ago ?

am 31.07.2011 11:46:14 von Halid Faith

Hi

How can I get all records exact 5 days ago from a table, neither 6 days nor
4 days ?

Could you give me an example ?

Thanks


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: How select all records exact x days ago ?

am 31.07.2011 12:24:39 von Johan De Meersman

Depends on how your table is set up (you're going to need a date in the data...) but probably something along the lines of "where createDate = date_sub(now(), interval 5 days)".

----- Original Message -----
> From: "yavuz maslak"
> To: mysql@lists.mysql.com
> Sent: Sunday, 31 July, 2011 11:46:14 AM
> Subject: How select all records exact x days ago ?
>
> Hi
>
> How can I get all records exact 5 days ago from a table, neither 6
> days nor
> 4 days ?
>
> Could you give me an example ?
>
> Thanks
>

--
Bier met grenadyn
Is als mosterd by den wyn
Sy die't drinkt, is eene kwezel
Hy die't drinkt, is ras een ezel

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

RE: How select all records exact x days ago ?

am 31.07.2011 19:18:46 von Halid Faith

I don't want all records during 5 days ( 24*5days ) . Only I need records
at 5 days ago ( for instance 24 hours on 26 th July 2011) ?

How can I do that ?



>Depends on how your table is set up (you're going to need a date in the
data...) but probably something along the lines of "where createDate =
date_sub(now(), interval 5 days)".

> Hi
>
> How can I get all records exact 5 days ago from a table, neither 6
> days nor
> 4 days ?
>
> Could you give me an example ?
>
> Thanks
>

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=maslak@ihlas.net.tr


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: How select all records exact x days ago ?

am 31.07.2011 19:59:33 von Shawn Wilson

mysql> select day(now())-5;
+--------------+
| day(now())-5 |
+--------------+
| 26 |
+--------------+


2011/7/31 yavuz maslak :
>
> I don't want all records during 5 days ( 24*5days ) . Only I need =A0reco=
rds
> at 5 days ago ( for instance 24 hours on 26 th July 2011) ?
>
> How can I do that ?
>
>
>
>>Depends on how your table is set up (you're going to need a date in the
> data...) but probably something along the lines of "where createDate =3D
> date_sub(now(), interval 5 days)".
>
>> Hi
>>
>> How can I get all records exact 5 days ago from a table, neither 6
>> days nor
>> 4 days ?
>>
>> Could you give me an example ?
>>
>> Thanks
>>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: =A0 =A0http://lists.mysql.com/mysql?unsub=3Dmaslak@ihlas.=
net.tr
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: =A0 =A0http://lists.mysql.com/mysql?unsub=3Dag4ve.us@gmai=
l.com
>
>

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg

Re: How select all records exact x days ago ?

am 01.08.2011 14:24:44 von shawn.l.green

On 7/31/2011 13:18, yavuz maslak wrote:
>
> I don't want all records during 5 days ( 24*5days ) . Only I need records
> at 5 days ago ( for instance 24 hours on 26 th July 2011) ?
>
> How can I do that ?
>

Show us your table definition (the "CREATE TABLE ..." form, please),
tell us which column you want to base your time comparison on, and
someone will show you an example.

--
Shawn Green
MySQL Principal Technical Support Engineer
Oracle USA, Inc. - Hardware and Software, Engineered to Work Together.
Office: Blountville, TN

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: How select all records exact x days ago ?

am 01.08.2011 18:11:16 von Johan De Meersman

----- Original Message -----
> From: "yavuz maslak"
>
> I don't want all records during 5 days ( 24*5days ) . Only I need
> records at 5 days ago ( for instance 24 hours on 26 th July 2011) ?

Which is what I gave you. You may want to read the fine documentation online before complaining :-)

--
Bier met grenadyn
Is als mosterd by den wyn
Sy die't drinkt, is eene kwezel
Hy die't drinkt, is ras een ezel

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org