Re: Using Date Functions in Where Clause

2008-04-19 Thread Baron Schwartz
Hi, On Mon, Apr 14, 2008 at 1:54 PM, Jamie Madill <[EMAIL PROTECTED]> wrote: > Hello, > > Basically I want to know if this is a good query for indexing. > > I have the following query: > > select > count(1) as count > from > session > where > last >= DATE_SUB(NOW(), INTERVAL :from SECON

Using Date Functions in Where Clause

2008-04-14 Thread Jamie Madill
Hello, Basically I want to know if this is a good query for indexing. I have the following query: select count(1) as count from session where last >= DATE_SUB(NOW(), INTERVAL :from SECOND) Is it safe to assume that the expression calling the function DATE_SUB is evaluated just once to a f

Re: Date functions

2006-07-07 Thread Chris W
Addison, Mark wrote: From: Chris W Sent: 07 July 2006 09:23 It's late and I just gave up reading the manual. Can someone please tell me the easiest way to do a query that will return all rows with a time stamp that is X number of seconds older than the current time? Something like this

Re: Date functions

2006-07-07 Thread Brent Baisley
-- From: "Chris W" <[EMAIL PROTECTED]> To: Sent: Friday, July 07, 2006 4:23 AM Subject: Date functions It's late and I just gave up reading the manual. Can someone please tell me the easiest way to do a query that will return all rows with a time stamp that is X number of s

Re: Date functions

2006-07-07 Thread Dan Buettner
Try this: SELECT * FROM t where TimeCol < date_sub( now(), INTERVAL x SECOND ) Dan On 7/7/06, Chris W <[EMAIL PROTECTED]> wrote: It's late and I just gave up reading the manual. Can someone please tell me the easiest way to do a query that will return all rows with a time stamp that is X num

RE: Date functions

2006-07-07 Thread Addison, Mark
From: Chris W Sent: 07 July 2006 09:23 > > It's late and I just gave up reading the manual. Can someone please > tell me the easiest way to do a query that will return all > rows with a > time stamp that is X number of seconds older than the current time? > Something like this. > > SEL

Date functions

2006-07-07 Thread Chris W
It's late and I just gave up reading the manual. Can someone please tell me the easiest way to do a query that will return all rows with a time stamp that is X number of seconds older than the current time? Something like this. SELECT * FROM t WHERE TimeCol < (now() - 60*60*24*3) Yes I

Re: puzzled by date functions (long)

2006-03-01 Thread Dan Nelson
In the last episode (Mar 01), Giuseppe Maxia said: > Yesterday I was analyzing the behavior of the query optimizer, and I > stumbled into a most curious case. I created two functions returning > the extremes of a date range, and I wanted to see how many times > those functions were called when used

puzzled by date functions (long)

2006-03-01 Thread Giuseppe Maxia
Yesterday I was analyzing the behavior of the query optimizer, and I stumbled into a most curious case. I created two functions returning the extremes of a date range, and I wanted to see how many times those functions were called when used in a WHERE clause So I added log tracing instructions to

Re: mysql/php date functions..

2005-09-26 Thread gerald_clark
bruce wrote: hi... i've got a question/problem that i can't seem to figure out. it should be simple/straightforward. i'm creating a test tbl id int t1 timestamp when i do a 'select * from tbl' i get what looks like a default date/time format in the timestamp column. i do a, (from mysql) 'ins

mysql/php date functions..

2005-09-26 Thread bruce
hi... i've got a question/problem that i can't seem to figure out. it should be simple/straightforward. i'm creating a test tbl id int t1 timestamp when i do a 'select * from tbl' i get what looks like a default date/time format in the timestamp column. i do a, (from mysql) 'insert into tbl

Re: Date Functions in MySQL

2005-02-23 Thread Clarence
Shoot me now, please. Thanks - I don't know how I missed that! Thanks - re-ran the query and things seem to be a-ok! On Wed, 23 Feb 2005 18:42:17 +0100, Roger Baklund <[EMAIL PROTECTED]> wrote: > Clarence wrote: > > I have a log table that records certain transactions on one of my sites. > > I'm

Re: Date Functions in MySQL

2005-02-23 Thread Roger Baklund
Clarence wrote: I have a log table that records certain transactions on one of my sites. I'm using a timestamp field to mark the date/time of each transaction. I'm trying to run a query that will display the transactions by date using the following SQL: SELECT COUNT(log_id) AS total, WEEK(FROM_UN

Date Functions in MySQL

2005-02-23 Thread Clarence
I have a log table that records certain transactions on one of my sites. I'm using a timestamp field to mark the date/time of each transaction. I'm trying to run a query that will display the transactions by date using the following SQL: SELECT COUNT(log_id) AS total, WEEK(FROM_UNIXTIME(UNIX_TIM

Re: Optimizing selects based on date functions.

2004-06-24 Thread mos
At 03:49 PM 6/24/2004, you wrote: Hello. My question concerns a large data table that has a DATETIME column called dt. Specifically, I am often having to do selects based on date and time functions that look like this: select * from my_table where hour(dt)= 0 or select * from my_table where mon

Re: Optimizing selects based on date functions.

2004-06-24 Thread Keith Ivey
chastang wrote: select * from my_table where hour(dt)= 0 or select * from my_table where month(dt) = 6 What index should I create to optimize selects on these sorts of queries? An index isn't going to help you there unless you create separate columns for hour and month. The columns will be redund

Re: Optimizing selects based on date functions.

2004-06-24 Thread SGreen
cc: Fax to: 06/24/2004 04:49 Subject: Optimizing selects based on date functions.

Optimizing selects based on date functions.

2004-06-24 Thread chastang
Hello. My question concerns a large data table that has a DATETIME column called dt. Specifically, I am often having to do selects based on date and time functions that look like this: select * from my_table where hour(dt)= 0 or select * from my_table where month(dt) = 6 What index should I cre

Re: date functions

2003-02-16 Thread Paul DuBois
At 17:24 -0500 2/16/03, Melih Onvural wrote: Hi all i'm new to the SQL programming language and i was trying to play with a date/time counter of sorts. I was trying to teach myself the various date functions, but I feel like I've failed. I had a database with birthdates in

Re: date functions

2003-02-16 Thread Stefan Hinz
Melih, > Year(Date - BirthDate) - 1900 What you're looking for is in the manual. Check it out: http://www.mysql.com/doc/en/Date_calculations.html Have fun! :) Regards, -- Stefan Hinz <[EMAIL PROTECTED]> iConnect GmbH Heesestr. 6, 12169 Berlin (Germany) Telefon: +49

Re: date functions

2003-02-16 Thread Jerry
CTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, February 16, 2003 11:11 PM Subject: date functions > > Hi all > > > > i'm new to the SQL programming language and i was trying to play with > > a date/time counter of sorts. I was trying to teach myself the various

date functions

2003-02-16 Thread Melih Onvural
Hi all i'm new to the SQL programming language and i was trying to play with a date/time counter of sorts. I was trying to teach myself the various date functions, but I feel like I've failed. I had a database with birthdates in it, and I subtracted that from date in the Year() fu

date functions

2003-02-16 Thread Melih Onvural
Hi all i'm new to the SQL programming language and i was trying to play with a date/time counter of sorts. I was trying to teach myself the various date functions, but I feel like I've failed. I had a database with birthdates in it, and I subtracted that from date in the Year() fu

date functions query problem

2002-07-29 Thread Rob
Hello, I am having trouble with a particular problem. I am trying to find a formulate query that calculates the no of weekdays and no of weekend day in any given month. I already have a method of generating the number of days in a given month but at that point I am at a loss. Any ideas? Than

Re: Mysql Date Functions - input

2002-03-01 Thread Marjolein Katsma
Keith, At 21:51 2002-02-28, you wrote: >That has certain advantages, but it's a pain for the user if it's in >a application where you have to enter a lot of dates or fill out a >form repeatedly. For that sort of data entry, typing digits is far >preferable to selecting from a dropdown list.

Re: Mysql Date Functions - input

2002-02-28 Thread Keith C. Ivey
On 28 Feb 2002, at 21:24, Marjolein Katsma wrote: > The easiest way to work around all the date formats of the world > for data input on a web page is to simply split the input into > three parts: year, month and day. Month and day can then be > dropdown lists (built-in -partial- validation!) and

Re: Mysql Date Functions - input

2002-02-28 Thread Marjolein Katsma
At 15:02 2002-02-28, you wrote: >Hi all, > >I asked this question on the PHP-DB list but everyone was asleep (no >response). > >= = = = = = = >I have a site where dates are being displayed and also entered by users. I >don't want to offend them by asking them to use

RE: Mysql Date Functions - input

2002-02-28 Thread John Lodge
Message- From: Paul DuBois [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 28, 2002 3:58 PM To: George Pitcher; [EMAIL PROTECTED] Subject: Re: Mysql Date Functions - input At 14:02 + 2/28/02, George Pitcher wrote: >Hi all, > >I asked this question on the PHP-DB list but eve

Re: Mysql Date Functions - input

2002-02-28 Thread Paul DuBois
At 14:02 + 2/28/02, George Pitcher wrote: >Hi all, > >I asked this question on the PHP-DB list but everyone was asleep (no >response). > >= = = = = = = >I have a site where dates are being displayed and also entered by users. I >don't want to offend them by asking

Mysql Date Functions - input

2002-02-28 Thread George Pitcher
Hi all, I asked this question on the PHP-DB list but everyone was asleep (no response). = = = = = = = I have a site where dates are being displayed and also entered by users. I don't want to offend them by asking them to use the -mm-dd format or to split the dat

Re: Proposal for two (or more) new time and date functions

2001-11-29 Thread Michael Widenius
Hi! > "Jeremy" == Jeremy Zawodny <[EMAIL PROTECTED]> writes: Jeremy> On Wed, Nov 28, 2001 at 01:30:42PM -0800, [EMAIL PROTECTED] wrote: >> >> I think while you've got the hood up, a better method of doing the >> difference between two dates should be derived. >> >> Unless I'm going about

RE: Proposal for two (or more) new time and date functions

2001-11-28 Thread Alok K. Dhir
ay, November 28, 2001 3:50 PM > To: [EMAIL PROTECTED] > Subject: Re: Proposal for two (or more) new time and date functions > > > > I think while you've got the hood up, a better method of > doing the difference between two dates should be derived. > > Unless I&#x

Re: Proposal for two (or more) new time and date functions

2001-11-28 Thread btjones
I think while you've got the hood up, a better method of doing the difference between two dates should be derived. Unless I'm going about this all wrong, the only way to get the time difference between two values currently is: UNIX_TIMESTAMP(end_datetime) - UNIX_TIMESTAMP(start_datetime)

bugs / inconsistencies with date functions

2001-10-31 Thread Michael Widenius
Hi! > "oliver" == oliver <[EMAIL PROTECTED]> writes: >> Description: oliver> I have found some inconsistencies (one may call them bugs ;-) in the oliver> current MySQL 3.23 version. I tested this on Linux and Solaris 2.8 oliver> so this should not be platform specif

bugs / inconsistencies with date functions

2001-10-30 Thread oliver
0-00",NULL,DAYOFYEAR(Gueltig)) FROM xx; but this would mean to check all programs... >Submitter-Id: >Originator: >Organization: >MySQL support: none >Synopsis: bugs / inconsistencies with date functions >Severity: non-critical >Priority: medium &

RE: Date functions returning Strings

2001-09-05 Thread Venu
Hi !!! )-Original Message- )From: Ghislain Gadbois [mailto:[EMAIL PROTECTED]] )Sent: Wednesday, September 05, 2001 7:37 AM )To: MySQL List (E-mail) )Subject: Date functions returning Strings ) ) )Hi, ) )I'm using MM JDBC driver version 2.0.4 to access a MySQL database )3.23.

Date functions returning Strings

2001-09-05 Thread Ghislain Gadbois
Hi, I'm using MM JDBC driver version 2.0.4 to access a MySQL database 3.23.40 on Solaris 2.8. When I do the following query "SELECT NOW()", I always get String data and not Date data when fetching the data. Is it normal that Date functions returns a String? Is t

Why DATE functions return a String in SELECT

2001-08-27 Thread Ghislain . Gadbois
>Description: I use the MM JDBC driver version 2.0.4 to access my MySQL database from my Java app. If I do "SELECT NOW()", it returns a String object and not a Date object. I tried to call different functions (e.g. "SELECT DATE_ADD(NOW(), INTERVAL 0 SECOND)") in order to have a Date i

mind twisting question on date functions

2001-08-17 Thread Phil Stewart
I've ran into a wall with the MAX() function when used with DATE_ADD(). I'm posting to the list in hopes that someone has an idea, comments, or suggestions for me. This is the problem at hand: Given: SELECT (TO_DAYS(MAX(DATE_ADD(T.StartDate, INTERVAL T.Duration Day - (TO_DAYS(T.Sta

Re: date functions crash

2001-04-05 Thread Sasha Pachev
On Wednesday 04 April 2001 04:03, Max Hammond wrote: > I'll just add that if anyone wants a dump of the data causing this, drop > me a note at [EMAIL PROTECTED] and I'll mail it to you, it's about 2500 > rows, and only that one field necessary to crash it. > > Cheers, > > Max Fix: --- 1.11/sql

Re: date functions in GROUP BY?

2001-02-19 Thread Fred van Engen
On Mon, Feb 19, 2001 at 11:06:21AM -0800, [EMAIL PROTECTED] wrote: > I have a table with a date field, and would like to sort it > on month and day. What I would like to do is: > > > SELECT lastname,firstname,dob FROM table1 GROUP BY month(dob),day(dob) > > (where dob is a column of type 'da

date functions in GROUP BY?

2001-02-19 Thread stirra
I have a table with a date field, and would like to sort it on month and day. What I would like to do is: SELECT lastname,firstname,dob FROM table1 GROUP BY month(dob),day(dob) (where dob is a column of type 'date') but that doesn't work. I'm using MySQL 3.22.32. I saw one post about calc