Re: TO_DAYS Date Range Question

2008-04-24 Thread Sebastian Mendel
David Perron schrieb: Hi Sebastian- Wanted to follow up on this. I figured out the problem. You actually have to use the LEAST & GREATEST operators when comparing multiple values, this statement works perfectly. LEAST(EndDays,Q2EndDays) - GREATEST(Q2StartDays,StartDays) as DaysInQ2, Thank

Re: TO_DAYS Date Range Question

2008-04-23 Thread Sebastian Mendel
David Perron schrieb: Hello Users- I think I have an interesting question with regards to applying a function to date range, I think half of problem solving is explaining it to an audience so please, bear with me. There is a table Orders that has two DATE columns, StartDate and EndDate. The

TO_DAYS Date Range Question

2008-04-23 Thread David Perron
Hello Users- I think I have an interesting question with regards to applying a function to date range, I think half of problem solving is explaining it to an audience so please, bear with me. There is a table Orders that has two DATE columns, StartDate and EndDate. The range of dates can vary

Re: Statement for a date range

2008-01-31 Thread dpgirago
> I have a report that contains a WHERE statement to report on a date range in > Pentaho. > > WHERE > InOut.MOVEMENTDATE >= (CURRENT_DATE - 7) > > I want to show on the report what the first date of this range is. Can > someone help me with this statement? So if the

Statement for a date range

2008-01-31 Thread mike_mcmillan
I have a report that contains a WHERE statement to report on a date range in Pentaho. WHERE InOut.MOVEMENTDATE >= (CURRENT_DATE - 7) I want to show on the report what the first date of this range is. Can someone help me with this statement? So if the last seven days is January 24, 2008

Re: problem with excluded days in date range query.

2006-02-03 Thread Peter Brawley
Paul, If there are no data for a particular day, it is not included. Is there a way to include all days even if the result is 0? I saw an example that included another table with all dates and an inner join but that seems a little clunky. In SQL, enumerating data you don't have requires some

Re: problem with excluded days in date range query.

2006-02-03 Thread sheeri kritzer
Database software is not a calendar. The data you put in is the data you get out. If the day is never put in, you'll never get it out. You need to have some data source that has all the days in it, like an external table, if you want to be able to retrieve that data. Otherwise, you could do it

problem with excluded days in date range query.

2006-02-03 Thread Paul Halliday
I have the following query: select count(*) as cnt, date(timestamp) as day from table where date_sub(curdate(),interval 14 day) <= timestamp group by day; If there are no data for a particular day, it is not included. Is there a way to include all days even if the result is 0? I saw an example th

Re: Optimal index for date range query with order by using index for sort???

2005-10-24 Thread sheeri kritzer
Is the DATE field a timestamp column? What's your schema? What's your primary key? I ask this because the real question is, "is it safe to assume that new entries are for the current day it is inserted?" If the answer to that question is yes, you can use an id field (or an existing one) to find

Optimal index for date range query with order by using index for sort???

2005-10-24 Thread Kevin Burton
OK. I need help with the following query: SELECT * FROM PRODUCT WHERE DATE > ? ORDER BY PRICE; Basically find products created since a given date and order by prices. I could put an index of DATE, PRICE but it will have to resort to a filesort since DATE isn't a constant value. I was thin

Re: determing number of Tuesdays within a date range

2005-04-28 Thread Peter Brawley
James, >I need to figure out how many Tuesdays are contained >within 1/1/2004 - 5/1/2004, and I need to come up with >a result where I know how many of each day of the week >is within that date range. Supposing a table named tbl and datetime columns named d1 and d2, something li

re: determing number of Tuesdays within a date range

2005-04-28 Thread James Black
Tuesdays are contained within 1/1/2004 - 5/1/2004, and I need to come up with a result where I know how many of each day of the week is within that date range. I am hoping someone may have a solution, as, once I know the number of Tues then I can state the average number of sessions on a Tuesday at

Re: Date range with empty rows (Was: Intra-table join)

2004-10-14 Thread SGreen
n a ready to use format with no post-processing required... > > I'm graphing the data from this query using dates on the x axis. The > input to my graph module (GD::Graph) requires a constant-length list. > So if any days in my selection range have no data, I need to fill the &

Re: Date range with empty rows (Was: Intra-table join)

2004-10-14 Thread Harald Fuchs
I need to fill the > space with an empy value. > For example, say my date range is '2004-10-01' to '2004-10-05' > and the query returns: > day, amount > 2004-10-01, 50 > 2004-10-02, 100 > 2004-10-04, 250 > I have to do some date manipulation in perl af

Date range with empty rows (Was: Intra-table join)

2004-10-13 Thread Partap Davis
from this query using dates on the x axis. The input to my graph module (GD::Graph) requires a constant-length list. So if any days in my selection range have no data, I need to fill the space with an empy value. For example, say my date range is '2004-10-01' to '2004-10-05

Re: Date Range

2004-09-27 Thread Dirk Bremer \(NISC\)
- Original Message - From: <[EMAIL PROTECTED]> To: "Dirk Bremer (NISC)" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Monday, September 27, 2004 14:30 Subject: Re: Date Range > I think you are very close but you are missing the LAST day of each mont

Re: Date Range

2004-09-27 Thread SGreen
er \(NISC\)" <[EMAIL PROTECTED]> wrote on 09/27/2004 03:18:46 PM: > - Original Message - > From: <[EMAIL PROTECTED]> > To: "Dirk Bremer (NISC)" <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Monday, September 27, 2004 11:40 > S

Re: Date Range

2004-09-27 Thread Dirk Bremer \(NISC\)
- Original Message - From: <[EMAIL PROTECTED]> To: "Dirk Bremer (NISC)" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Monday, September 27, 2004 11:40 Subject: Re: Date Range > To compute the date range for "two months ago". (if the curre

Re: Date Range

2004-09-27 Thread Paul DuBois
ROTECTED]> >Cc: <[EMAIL PROTECTED]> >Sent: Monday, September 27, 2004 11:40 >Subject: Re: Date Range > > >> I see that you are on 4.0.18 so you can't use many of the new date >> functions (4.1.1+) but has to be an easier way. Let's try thi

Re: Date Range

2004-09-27 Thread Paul DuBois
At 12:57 -0500 9/27/04, Dirk Bremer (NISC) wrote: - Original Message - From: <[EMAIL PROTECTED]> To: "Dirk Bremer (NISC)" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Monday, September 27, 2004 11:40 Subject: Re: Date Range I see that you are on 4.0.18

Re: Date Range

2004-09-27 Thread Dirk Bremer \(NISC\)
> Whether he needs semicolons depends on which tool he is using to execute > his statements. If he is using the MySQL client or any of several other > tools, I agree. If he is going through an ODBC connection, he doesn't need > them. (At least my 3.52.x drivers can't accept more than one statement

Re: Date Range

2004-09-27 Thread SGreen
MAIL PROTECTED]> > >Sent: Monday, September 27, 2004 11:40 > >Subject: Re: Date Range > > > > > >> I see that you are on 4.0.18 so you can't use many of the new date > >> functions (4.1.1+) but has to be an easier way. Let's try this for

Re: Help with SELECT statement for date range

2003-08-19 Thread shaag
Hi, try this: SELECT * FROM your_table WHERE StartDate > NOW() AND EndDate < NOW() > Hello, > > I am having a problem when doing a SELECT. Here is the > scenerio: > > I have a table that has an event StartDate and > EndDate, based on the current Date "NOW()" I need to > know which records are

RE: Help with SELECT statement for date range

2003-08-19 Thread Ralph Guzman
SELECT * FROM table_name WHERE EndDate < now(); Is this what you need? -Original Message- From: Rob Sirota [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 19, 2003 4:12 AM To: [EMAIL PROTECTED] Subject: Help with SELECT statement for date range Hello, I am having a problem when do

Re: Help with SELECT statement for date range

2003-08-19 Thread Antony Dovgal
On Tue, 19 Aug 2003 04:11:32 -0700 (PDT) Rob Sirota <[EMAIL PROTECTED]> wrote: > Hello, > > I am having a problem when doing a SELECT. Here is the > scenerio: > > I have a table that has an event StartDate and > EndDate, based on the current Date "NOW()" I need to > know which records are curren

Help with SELECT statement for date range

2003-08-19 Thread Rob Sirota
Hello, I am having a problem when doing a SELECT. Here is the scenerio: I have a table that has an event StartDate and EndDate, based on the current Date "NOW()" I need to know which records are currently active. Can anyone help with a quick SELECT statement? Thanks. = ___

RE: Help with Date Range Query

2003-06-06 Thread Mike Hillyer
Aah, I stand corrected. Friday afternoon is not my best day to be answering questions on here. ;) Regards, Mike Hillyer www.vbmysql.com -Original Message- From: Keith C. Ivey [mailto:[EMAIL PROTECTED] Sent: Friday, June 06, 2003 1:59 PM To: [EMAIL PROTECTED] Subject: RE: Help with Date

RE: Help with Date Range Query

2003-06-06 Thread Keith C. Ivey
On 6 Jun 2003 at 13:43, Mike Hillyer wrote: > SELECT StartDate FROM Events > WHERE 0 <= TO_DAYS(NOW()) - TO_DAYS(StartDate) <= 30; I don't think that's doing what you think it is. In math notation <= can be chained that way, but not in most programming languages. 0 <= x <= 30 is equivalen

Re: Help with Date Range Query

2003-06-06 Thread Keith C. Ivey
On 6 Jun 2003 at 20:34, Trevor Sather wrote: > mysql> SELECT StartDate FROM Events > -> WHERE TO_DAYS(NOW()) - TO_DAYS(StartDate) <= 30; > ++ > | StartDate | > ++ > | 2004122600 | > | 2003072100 | > | 2003080600 | > | 2003092600 | > | 200305

RE: Help with Date Range Query

2003-06-06 Thread Trevor Sather
Thanks very much (to all who replied) -- this looks good! Best wishes -Original Message- From: Paul DuBois [mailto:[EMAIL PROTECTED] Sent: 06 June 2003 20:46 To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: Help with Date Range Query At 20:34 +0100 6/6/03, Trevor Sather wrote

Re: Help with Date Range Query

2003-06-06 Thread Paul DuBois
At 20:34 +0100 6/6/03, Trevor Sather wrote: Hello, Any idea why the following doesn't work? It's taken from the MySQL manual which says it should return records in the last 30 days. As you can see, I'm getting records spanning some 19 months from last May to December 2004... The example probably

Re: Help with Date Range Query

2003-06-06 Thread gerald_clark
Because now - a future date is a negative number, and therefore < 30. Trevor Sather wrote: Hello, Any idea why the following doesn't work? It's taken from the MySQL manual which says it should return records in the last 30 days. As you can see, I'm getting records spanning some 19 months from

RE: Help with Date Range Query

2003-06-06 Thread Mike Hillyer
()) - TO_DAYS(StartDate) <= 30; Regards, Mike Hillyer www.vbmysql.com -Original Message- From: Trevor Sather [mailto:[EMAIL PROTECTED] Sent: Friday, June 06, 2003 1:34 PM To: [EMAIL PROTECTED] Subject: Help with Date Range Query Hello, Any idea why the following doesn't work?

Help with Date Range Query

2003-06-06 Thread Trevor Sather
Hello, Any idea why the following doesn't work? It's taken from the MySQL manual which says it should return records in the last 30 days. As you can see, I'm getting records spanning some 19 months from last May to December 2004... mysql> SELECT StartDate FROM Events -> WHERE TO_DAYS(NOW())

Date Range

2003-01-29 Thread Melissa Stranzl
Hi all, I am trying to get my mysql database to be searchable by date, by both current and past events. My perl program doesn't compile--- here's an excerpt-- package Date::Range; my $range = Date::Range -> new ($date1, $date2); error message: -- can't locate

Re: question about date range

2003-01-28 Thread Brent Baisley
You may want to strongly consider converting the data to a timestamp field type, but that's for down the road. You want to do you search like any other range search you would do. select * from orderheadr where orderid between "2003012400" and "2003012499" You're saying you want to searc

Re: question about date range

2003-01-25 Thread Stefan Hinz, iConnect \(Berlin\)
Berlin (Germany) Tel: +49 30 7970948-0 Fax: +49 30 7970948-3 - Original Message - From: "Chuck Barnett" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, January 24, 2003 6:33 PM Subject: question about date range > Hi, I inherited a db that has a varch

question about date range

2003-01-24 Thread Chuck Barnett
Hi, I inherited a db that has a varchar(30) column that holds a date/time stamp in the form of MMDDHHmmss (ex: 20030124093952) Well I want to select a range based on the first 8 characters(MMDD). I currently select a single day by select * from orderheader where orderid like '$date' ; T

Selecting from within date range

2002-03-04 Thread Victoria Reznichenko
torkil, Monday, March 04, 2002, 10:57:50 AM, you wrote: tj> I have a database table containing log files that are written by tj> different individuals almost every day. tj> So at any given time I want to be able to go through a web tj> interface and get a list over logs written in any given mo

Re: Selecting from within date range

2002-03-04 Thread DL Neil
Torkil, > I have a database table containing log files that are written by different individuals almost every day. > > So at any given time I want to be able to go through a web interface and get a list over logs written in any given month. > > People writing in this log also work in different de

Selecting from within date range

2002-03-04 Thread torkil.johnsen
I have a database table containing log files that are written by different individuals almost every day. So at any given time I want to be able to go through a web interface and get a list over logs written in any given month. People writing in this log also work in different department, a fie