Unix Technical Forum

Data inizio e Data fine

This is a discussion on Data inizio e Data fine within the MySQL forums, part of the Database Server Software category; --> Ciao a tutti, ho un problema nel fare una select di una data inizio e data fine AND (dataSpedizione ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-28-2008, 05:41 AM
Sarah
 
Posts: n/a
Default Data inizio e Data fine

Ciao a tutti, ho un problema nel fare una select di una data inizio e
data fine


AND (dataSpedizione <= date(now()) AND dataSpedizione <
DATE_ADD(date(now()),Interval 1 day)) GROUP BY idSpedizioni

non mi recupera tutte le "spedizioni" del giorno


cosa sbaglio??
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-28-2008, 05:41 AM
Michael Austin
 
Posts: n/a
Default Re: Data inizio e Data fine

Sarah wrote:
> Ciao a tutti, ho un problema nel fare una select di una data inizio e
> data fine
>
>
> AND (dataSpedizione <= date(now()) AND dataSpedizione <
> DATE_ADD(date(now()),Interval 1 day)) GROUP BY idSpedizioni
>
> non mi recupera tutte le "spedizioni" del giorno
>
>
> cosa sbaglio??



TRANSLATED:


Hello everyone, I have a problem in doing a select a start date and end date


> AND (dataSpedizione <= date(now()) AND dataSpedizione <
> DATE_ADD(date(now()),Interval 1 day)) GROUP BY idSpedizioni


I do not recover all "shipments" of the day


What mistake?

================================================== =============


mysql> select now(),DATE_ADD(date(now()),Interval 1 day) as next;
+---------------------+------------+
| now() | next |
+---------------------+------------+
| 2008-03-24 17:10:49 | 2008-03-25 |
+---------------------+------------+

your query gets ALL data:

mysql> select * from ship where
-> (a <=now() and a < DATE_ADD(date(now()),Interval 1 day));
+------+---------------------+
| t | a |
+------+---------------------+
| 1 | 2008-03-24 17:13:49 |
| 2 | 2008-03-24 17:13:55 |
| 3 | 2008-03-24 17:14:01 |
| 4 | 2006-03-24 00:00:00 |<<<<---YEAR is 2006
| 4 | 2005-03-24 17:13:00 |<<<<---YEAR is 2005
+------+---------------------+
5 rows in set (0.00 sec)


Try:

mysql> select * from ship where a > cast(Now() as date) and a < now();
+------+---------------------+
| t | a |
+------+---------------------+
| 1 | 2008-03-24 17:13:49 | <<--TODAY
| 2 | 2008-03-24 17:13:55 | <<--TODAY
| 3 | 2008-03-24 17:14:01 | <<--TODAY
+------+---------------------+
3 rows in set (0.00 sec)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-28-2008, 05:41 AM
Miky
 
Posts: n/a
Default Re: Data inizio e Data fine


>
> mysql> select now(),DATE_ADD(date(now()),Interval 1 day) as next;
> +---------------------+------------+
> | now() | next |
> +---------------------+------------+
> | 2008-03-24 17:10:49 | 2008-03-25 |
> +---------------------+------------+
>
> your query gets ALL data:
>
> mysql> select * from ship where
> -> (a <=now() and a < DATE_ADD(date(now()),Interval 1 day));
> +------+---------------------+
> | t | a |
> +------+---------------------+
> | 1 | 2008-03-24 17:13:49 |
> | 2 | 2008-03-24 17:13:55 |
> | 3 | 2008-03-24 17:14:01 |
> | 4 | 2006-03-24 00:00:00 |<<<<---YEAR is 2006
> | 4 | 2005-03-24 17:13:00 |<<<<---YEAR is 2005
> +------+---------------------+
> 5 rows in set (0.00 sec)
>
>
> Try:
>
> mysql> select * from ship where a > cast(Now() as date) and a < now();
> +------+---------------------+
> | t | a |
> +------+---------------------+
> | 1 | 2008-03-24 17:13:49 | <<--TODAY
> | 2 | 2008-03-24 17:13:55 | <<--TODAY
> | 3 | 2008-03-24 17:14:01 | <<--TODAY
> +------+---------------------+
> 3 rows in set (0.00 sec)




Thanks for help me!!! and Excuse me for the language ... I haven't seen
the language of the newsgroup!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:59 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com