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

Re: setting expiry date

2005-09-12 Thread tony
not sure i completely understand your question but i think the user enters a date, and you want to delete all records that match that date? also i'm assuming that the entered date hits your script as a post variable. if so, you need to convert the posted date into the same format as the re

setting expiry date

2005-09-12 Thread ross
  I have a php/mysql database with articles. What I need is a php sctipt or some mysql  that will compare the current day with the 'expiry date' entered by the user and if the there is a difference then drop it from the database..   I am fairly new to mysql so do not know if there

Re: Optimizing query "WHERE date>0"

2005-09-09 Thread Dan Baker
L,NULL,53587,Using where >>>> >>>>It appears that the index does NO good in this query. >>>>Is there anything I can do to optimize this query? Alter the table to >>>>improve the query? Do anything to not scan the entire stinkin' table? >>>&

Re: Optimizing query "WHERE date>0"

2005-09-08 Thread Devananda
mysql.com/doc/mysql/en/how-to-avoid-table-scan.html Another possibility would be to change your data structures so that you can use an equality, rather than a range scan. For example, make DateTimeNext into a "date" or "datetime" field (rather than an int), and then alter you

Re: Optimizing query "WHERE date>0"

2005-09-08 Thread Dan Baker
"Eric Bergen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > When you add that index are more than 30% of the rows in the table > DateTimeNext>1126215680? There are currently 28.53% of the rows that have "DateTimeNext>1126215680" Does this mean something of interest? If so, what?

Re: Optimizing query "WHERE date>0"

2005-09-08 Thread Eric Bergen
When you add that index are more than 30% of the rows in the table DateTimeNext>1126215680? Dan Baker wrote: I have lots of tables that are similar in nature: id int(11) PRI NULL auto_increment Name varchar(30) DateTimeNext int(11) The "DateTimeNext" field represents when this records needs

Optimizing query "WHERE date>0"

2005-09-08 Thread Dan Baker
I have lots of tables that are similar in nature: id int(11) PRI NULL auto_increment Name varchar(30) DateTimeNext int(11) The "DateTimeNext" field represents when this records needs attention. A value of zero indicates it is being ignored. There are times when *lots* of records DateTimeNext

RE: Date Ranges

2005-09-07 Thread Mark Leith
---snip-- > Given any two dates, MySQL can tell if a third date is within > that range. > That's easy. > > To actually return a list of all dates between any arbitrary > pair of dates requires some form of loop (v5.0+) or a lookup > into a table populated with all p

Re: Date Ranges

2005-09-06 Thread SGreen
"Shaun" <[EMAIL PROTECTED]> wrote on 09/06/2005 03:47:25 PM: > Hi, > > Given two dates, can Mysql calculate and return all the dates that occur > between them? > > Thanks for your advice. > > > Given any two dates, MySQL can tell if a third d

Re: Date Ranges

2005-09-06 Thread Paul DuBois
At 20:47 +0100 9/6/05, Shaun wrote: Hi, Given two dates, can Mysql calculate and return all the dates that occur between them? No. Given two dates, MySQL can determine which of a set of already-existing dates stored in a table occur between them and return those. -- Paul DuBois, MySQL Docume

Date Ranges

2005-09-06 Thread Shaun
Hi, Given two dates, can Mysql calculate and return all the dates that occur between them? Thanks for your advice. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: Date arithmetic: 2005-08-31 - 1

2005-08-24 Thread Peter Brawley
tely no, because I don't know if I'm being asked to add or subtract days. I'm just given a value, and have to transform that into something that can be added or subtracted. So for example, all I get with is value 1 meaning 1 day and I need to do something with a date, for db2 throug

Re: LATEST N RECORDS from a table without date field

2005-08-24 Thread Jason Pyeron
On Wed, 24 Aug 2005, Harald Fuchs wrote: "Praveen KS" <[EMAIL PROTECTED]> writes: Can anyone help with a query to retrieve latest N records. No auto_increment field. No date field. Primary key exists and is populated with random unique values. This means that the only pos

Re: LATEST N RECORDS from a table without date field

2005-08-24 Thread Pooly
e help with a query to retrieve latest N records. > > No auto_increment field. > > No date field. > > Primary key exists and is populated with random unique values. > > This means that the only possible definition for "latest" is "highest slno". > Transl

Re: LATEST N RECORDS from a table without date field

2005-08-24 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Praveen KS" <[EMAIL PROTECTED]> writes: > Can anyone help with a query to retrieve latest N records. > No auto_increment field. > No date field. > Primary key exists and is populated with random unique values. This means tha

Re: LATEST N RECORDS from a table without date field

2005-08-24 Thread Felix Geerinckx
On 24/08/2005, "Praveen KS" wrote: > Can anyone help with a query to retrieve latest N records. > > No auto_increment field. > No date field. > Primary key exists and is populated with random unique values. In a table, there are no such things as - the first record

LATEST N RECORDS from a table without date field

2005-08-24 Thread Praveen KS
Can anyone help with a query to retrieve latest N records. No auto_increment field. No date field. Primary key exists and is populated with random unique values. Eg: slno int(10) primary key (populated with random unique values) name char(20) Thanks in advance. PraveenKumarKS http

Re: Date arithmetic: 2005-08-31 - 1

2005-08-23 Thread Michael Stassen
[EMAIL PROTECTED] wrote: You are right. There are a lot of date functions in MySQL. However, I am not sure exactly what your needs are... I think you are trying to compute date intervals (did you NOT see the INTERVAL keyword when you RTFM?). Most of the date functions currently supported

Re: Date arithmetic: 2005-08-31 - 1

2005-08-23 Thread Michael Stassen
Barbara Deaton wrote: > All, > > I know MySQL comes with all sorts of wonderful functions to do date > arithmetic, the problem is the context that my application is being > called in I don't know if a user wants me to add or subtract days. I'm > just given the nu

RE: Date arithmetic: 2005-08-31 - 1

2005-08-23 Thread Barbara Deaton
Unfortunately no, because I don't know if I'm being asked to add or subtract days. I'm just given a value, and have to transform that into something that can be added or subtracted. So for example, all I get with is value 1 meaning 1 day and I need to do something with

Re: Date arithmetic: 2005-08-31 - 1

2005-08-23 Thread SGreen
"Barbara Deaton" <[EMAIL PROTECTED]> wrote on 08/23/2005 03:36:52 PM: > All, > > I know MySQL comes with all sorts of wonderful functions to do date > arithmetic, the problem is the context that my application is being > called in I don't know if a user want

RE: Date arithmetic: 2005-08-31 - 1

2005-08-23 Thread Gordon Bruce
+ 1 row in set (0.00 sec) mysql> select now() -> ; +-+ | now() | +-+ | 2005-08-23 15:38:31 | +-+ 1 row in set (0.00 sec) -Original Message- From: Barbara Deaton [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 23

AW: Date arithmetic: 2005-08-31 - 1

2005-08-23 Thread Freddie Sorensen
Barbara, Can't you use the ADDDATE function ? http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html Freddie > -Ursprüngliche Nachricht- > Von: Barbara Deaton [mailto:[EMAIL PROTECTED] > Gesendet: Dienstag, 23. August 2005 21:37 > An: mysql@lists.mysql.co

Date arithmetic: 2005-08-31 - 1

2005-08-23 Thread Barbara Deaton
All, I know MySQL comes with all sorts of wonderful functions to do date arithmetic, the problem is the context that my application is being called in I don't know if a user wants me to add or subtract days. I'm just given the number of days that need to be either added or subtracte

Re: Saving creation date

2005-08-17 Thread Gleb Paharenko
usch" <[EMAIL PROTECTED]> wrote: Hi, >I want to save date and time of the creation of a row in a field. > >That could be handled by a timestamp, I know that. > >But I don't want the value to be updated automatically after an update. > >I tried >

Saving creation date

2005-08-16 Thread Frank Busch
Hi, I want to save date and time of the creation of a row in a field. That could be handled by a timestamp, I know that. But I don't want the value to be updated automatically after an update. I tried . creation datetime not null default now() . in the create table statement, but g

Re: date comparison question

2005-08-01 Thread SGreen
fName`, `lName`, `acctOpenDate`) VALUES ('Ccc', > 'Cc', '2005-07-30 21:08:51'); > INSERT INTO `test` (`fName`, `lName`, `acctOpenDate`) VALUES ('Ddd', > 'Dd', '2005-07-30 05:05:48'); > > Thanks much, > Nishi > Yes, it

date comparison question

2005-08-01 Thread Kapoor, Nishikant
I am probably missing something very simple, but appreciate it if someone could point me to that. I am doing this query on following table to fetch recs for a month: SELECT fName, lName, acctOpenDate FROM test WHERE acctOpenDate >= '2005-07-01' AND acctOpenDate <= '2005-07-31'; I expect to see

Re: Date/Time Problem with V5.0.6 views

2005-07-28 Thread Gleb Paharenko
Hello. You said that you had created a view, but you continued using Tab_A instead of Tab_A_View in your next queries. Did you want to use view Tab_A_View? On my MySQL 5.0.9 all queries works both with view and original table. See: mysql> desc Tab_A; +++-

Date/Time Problem with V5.0.6 views

2005-07-22 Thread TheRefUmp
Hello everyone, I cannot figure this out. I have a table like the following: Tab_A datetime_field datetime not null, num_field bigint not null I do a SELECT as follows: Select datetime_field, num_field from Tab_A where datetime_field='2005-03-10' and num_field = 1234; I return 2 ro

Re: SELECT by date plus get both next and last dates with data in it

2005-07-20 Thread SGreen
"me you" <[EMAIL PROTECTED]> wrote on 07/20/2005 03:05:30 PM: > Hello, > > Having some problems trying to get the correct data from MySQL. I need to > grab a bunch of information based on a date the user selects (no problem > there). However, this is an even

SELECT by date plus get both next and last dates with data in it

2005-07-20 Thread me you
Hello, Having some problems trying to get the correct data from MySQL. I need to grab a bunch of information based on a date the user selects (no problem there). However, this is an events type situation, where I want to give people an easy option to move forward or backwards through the

Re: Dynamic insertion of date for LOAD INFILE

2005-06-28 Thread Gleb Paharenko
Hello. You could import data in the temporary table and then use a full power of INSERT... SELECT statement. For example: INSERT into t1 select col1,col2,curdate() from tmp_t1; David Perron <[EMAIL PROTECTED]> wrote: > Im trying to get dynamically insert the cur

Dynamic insertion of date for LOAD INFILE

2005-06-27 Thread David Perron
Im trying to get dynamically insert the current date into a LOAD FILE statement for some ETL automation, but Im having difficulty passing the string into the LOAD statement: This will not work. SELECT @Today:=CURDATE(); LOAD DATA LOCAL INFILE '/s3/data/[EMAIL PROTECTED]' INTO

Re: Database Table Date Assistance

2005-06-13 Thread mfatene
PROTECTED]>: > Hello, > > I would like to do the following: I am creating a site where people can add > items to a cart. In order to keep items for [X] amount of days, I would like > to create a database table in mysql to hold a 'itemRef' and a 'Date'. Then in

Re: Database Table Date Assistance

2005-05-17 Thread mfatene
Hi Scott, I show you timestamp usage, but there is also datetime and date. you can read detailled infos at : http://dev.mysql.com/doc/mysql/en/datetime.html mysql> create table items(itemRef varchar(10), dat timestamp default current_timestamp); Query OK, 0 rows affected (0.20 sec) mysql>

Database Table Date Assistance

2005-05-17 Thread Scott Purcell
Hello, I would like to do the following: I am creating a site where people can add items to a cart. In order to keep items for [X] amount of days, I would like to create a database table in mysql to hold a 'itemRef' and a 'Date'. Then in a relationship table I can hold the

Re: How to handle date and time conversions

2005-05-08 Thread Rhino
I'm not sure what you mean by date *conversions* but the date *functions* can be found here: http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html. You will probably use these for most conversions you attempt. Rhino - Original Message - From: "Robert A. Rawlinso

How to handle date and time conversions

2005-05-08 Thread Robert A. Rawlinson
I have read somewhere how to do the conversions but for some reason I can not find it again. Now I need to do conversions soon. Could someone direct me to where the documentation is located? Thanks for any help you can offer. Bob Rawlinson -- Robert A. Rawlinson Felicity Ohio 45120 -- MySQL Gen

Re: INSERT DATE using USA Date Format SOLUTION

2005-05-04 Thread Michael J. Pawlowsky
Dan Nelson wrote: >>Is there a way to specify the Date Format for an INSERT statement? >> >>Something like: >> >> INSERT INTO tblMyTable(myDate) VALUES(DATE_FORMAT('USA', '12-31-2004'); >> >> > >Try the STR_TO_DATE fu

Re: INSERT DATE using USA Date Format

2005-05-04 Thread Dan Nelson
In the last episode (May 04), Michael J. Pawlowsky said: > I have some data where the date is already in USA format > (MM-DD-). I would like to be able to insert this data without > having to massage the date in the code. MySQL seems to think that USA format is "MM.DD."

INSERT DATE using USA Date Format

2005-05-04 Thread Michael J. Pawlowsky
I have some data where the date is already in USA format (MM-DD-). I would like to be able to insert this data without having to massage the date in the code. Is there a way to specify the Date Format for an INSERT statement? Something like: INSERT INTO tblMyTable(myDate) VALUES

Re: Date validation using mysql

2005-04-29 Thread Anoop kumar V
Woww - this is great - I think this is exactly what I wanted!! Thanks a Ton Mikhail. :-) Anoop On 4/29/05, Mikhail Entaltsev <[EMAIL PROTECTED]> wrote: > > Hi Anoop, > > In order to validate a date I am using next query: > > select date_format(date_sub(dat

Re: Date validation using mysql

2005-04-29 Thread Mikhail Entaltsev
Hi Anoop, In order to validate a date I am using next query: select date_format(date_sub(date_add('', interval 1 day), interval 1 day),'%Y%m%d') = date_format('','%Y%m%d'); It will give you 1 if date is valid. Best regards, Mikhail. - Orig

Re: Date validation using mysql

2005-04-29 Thread Anoop kumar V
No problem - I followed up and found out that this function is not available. THought probably you were referring to a later version of Mysql.. anyways... We use Java - and maybe I could use that - I was just wondering if I could help reinventing something already there. Thanks so much for the

Re: Date validation using mysql

2005-04-29 Thread Chris Ramsay
Anoop You could try checkdate()... Apologies for erroneous advice - I am evidently suffering from list psychosis... Chris -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: Date validation using mysql

2005-04-29 Thread Brent Baisley
You can, sort of. You can use a type of query like this: select if(now()>'2005-04-28', 1, 0); Which will return a 1 or a 0 if the date is greater than the current date/time. But that's a very weak comparison, prone to error, since the date must be in the MySQL readable format.

Re: Date validation using mysql

2005-04-29 Thread Chris Ramsay
You could try checkdate()... chris -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: Date validation using mysql

2005-04-29 Thread Anoop kumar V
So is there a function in mysql that I can call to validate dates?? Or do I need to build it? Thanks, Anoop On 4/29/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > Anoop kumar V <[EMAIL PROTECTED]> wrote on 04/29/2005 11:00:11 AM: > > > Is it possi

Re: Date validation using mysql

2005-04-29 Thread SGreen
Anoop kumar V <[EMAIL PROTECTED]> wrote on 04/29/2005 11:00:11 AM: > Is it possible to do a date field validation using an sql query. > > Its like we have an html field- its a free form text field and the end user > should type in a valid date, of course in a predefined for

Date validation using mysql

2005-04-29 Thread Anoop kumar V
Is it possible to do a date field validation using an sql query. Its like we have an html field- its a free form text field and the end user should type in a valid date, of course in a predefined format only (MM/dd/yyy). I tried using javascript but either it works on some browsers and not in

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: HELP WITH A DATE QUERY USING 4.0.17

2005-04-18 Thread John Thorpe
y - I only show the date field here: select DATE_ADD(B.Booking_Start_Date,interval it.x day) from Bookings B,iterate it where B.User_ID = '610' and it.x >= 1 and it.x <= 10 group by DATE_ADD(B.Booking_Start_Date,interval it.x day) Regards, John -Original Message- > From:

HELP WITH A DATE QUERY USING 4.0.17

2005-04-08 Thread shaun thornburgh
RMAT(B.Booking_Start_Date, '%i'))) / 60) AS Available_Hours FROM Bookings B WHERE B.User_ID = '610' AND NOT ( '2005-04-08' < DATE_FORMAT(Booking_Start_Date, "%Y-%m-%d") OR '2005-04-08' > DATE_FORMAT(Booking_End_Date, "%Y-%m-%d") ) The pr

Re: DATE & TIME

2005-04-06 Thread Hans Bernard
icketing "; hans Rhino wrote: > - Original Message - > From: "Hans Bernard" <[EMAIL PROTECTED]> > To: > Sent: Wednesday, April 06, 2005 6:06 AM > Subject: DATE & TIME > > > Hello, > > > > i need to have the time in this output

Re: DATE & TIME

2005-04-06 Thread Rhino
- Original Message - From: "Hans Bernard" <[EMAIL PROTECTED]> To: Sent: Wednesday, April 06, 2005 6:06 AM Subject: DATE & TIME > Hello, > > i need to have the time in this output. in MySQL database > phpmyadmin always puts -00-00 > > i need i

Re: DATE & TIME

2005-04-06 Thread Christian Hammers
On Wed, Apr 06, 2005 at 12:06:37PM +0200, Hans Bernard wrote: > i need to have the time in this output. in MySQL database > phpmyadmin always puts -00-00 > > i need it to be like this > 01-APR-2005 >> DD-MMM- Use date_format(, "%d-%b-%Y %H:%m") in your SELECT? bye, -christian- --

DATE & TIME

2005-04-06 Thread Hans Bernard
Hello, i need to have the time in this output. in MySQL database phpmyadmin always puts -00-00 i need it to be like this 01-APR-2005 >> DD-MMM- the time needs to be like this 22:55 >> HH:MM can somebody help hans -- MySQL General Mailing List For list archives: http://lists.mysql.

Re: update random date

2005-04-03 Thread Michael Stassen
On Apr 3, 2005, at 6:45 PM, Jerry Swanson wrote: How to update randomly field date of datetime? I need to update randomly on 300 records Thanks Use RAND(). Se the manual for details <http://dev.mysql.com/doc/mysql/en/mathematical-functions.html>. If that's not enough to get you go

update random date

2005-04-03 Thread Jerry Swanson
How to update randomly field date of datetime? I need to update randomly on 300 records Thanks -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

RE: changing default date format on server

2005-03-24 Thread Tom Crimmins
ld -v --help | grep date_format --date_format=name The DATE format (For future). date_format (No default value) [/shell] This has been said before, but date_format is not implemented on the server. You can set it, but I don't think it does anything. > > J.R. &g

RE: changing default date format on server

2005-03-24 Thread J.R. Bullington
AIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, March 24, 2005 10:57 AM To: Mark Mchugh Cc: mysql list Subject: Re: changing default date format on server Mark Mchugh <[EMAIL PROTECTED]> wrote on 03/24/2005 10:26:44 AM: > hi, > How can i change the default date field to european f

RE: updating date fields using sql

2005-03-24 Thread J.R. Bullington
Check your DATE format in your server variables... MySQL default date format is -MM-DD. You can change it, however until then, you have to use update policies set renewdate = '2006/02/21' where polnumber = 'WRIM01002'; HTH, J.R. Hello. This is a frequently asked q

Re: Default Date Format

2005-03-24 Thread Gleb Paharenko
Hello. This is a frequently asked question. For example read these threads: http://lists.mysql.com/mysql/175324 http://lists.mysql.com/mysql/177730 Shuan <[EMAIL PROTECTED]> wrote: > Dear all, > > How to change the Default Date/DateTime Format of MySQL

Default Date Format

2005-03-23 Thread Shuan
Dear all, How to change the Default Date/DateTime Format of MySQL server? I'm using MySQL 4.1.10-nt on WinXP Pro. Thanks. Shuan -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: Converting Integer values to date type

2005-03-21 Thread Michael Stassen
DATE() if you use CONCAT() to put the string in the correct form in the first place. Try UPDATE tableDummy SET newDate = concat(YearVal,"-",MonthVal,"-",DayVal) instead. Michael And although I got an error, it did give all zero values for the date(e.g -00-00) no big deal

Re: Converting Integer values to date type

2005-03-18 Thread Mahmoud Badreddine
".",YearVal))','%d.%m.%Y')); And although I got an error, it did give all zero values for the date(e.g -00-00) no big deal now that I have what I want, but if someone can pick out my error, would be greatly apreciated. On Fri, 18 Mar 2005 13:31:14 -0600, Dan Nelso

Re: Converting Integer values to date type

2005-03-18 Thread Dan Nelson
In the last episode (Mar 18), Mahmoud Badreddine said: > Hello, > I have a table with separate integer values for the day, month and year. > I would like to group them all under one field of type date. > I tried a few commands but I haven't captured the right syntax yet. > >

Converting Integer values to date type

2005-03-18 Thread Mahmoud Badreddine
Hello, I have a table with separate integer values for the day, month and year. I would like to group them all under one field of type date. I tried a few commands but I haven't captured the right syntax yet. so if the field names are dayVal,monthVal and YearVal in talbeDummy I am doin

Bug? Date insert comes out zero on Solaris using Python MySQLdb?

2005-03-17 Thread Nick Arnett
I have Python code that I run on Windows and Solaris. It works properly on Windows. However, on Solaris, when it inserts records, datetime columns end up with a value of zero. I suspect that this began happening after we upgraded the MySQL server to 4.1.10 from a 4.0.x version (I think we we

date of end support (security update)

2005-03-15 Thread zdust
Hi i am searching the date of the end of support for the different versions of mysql where can i find them? thx -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: Help massage date import

2005-03-10 Thread SGreen
w data that needs to be added as a new column to the records in an existing table Please try to rephrase your problem using more precise terms. I can see one problem already, some TIMESTAMP fields are automatically filled in with a value EACH TIME a record is modified by the server (RTFM for det

Help massage date import

2005-03-09 Thread Scott Haneda
Mysql 4, I have datetime field set of -00-00 00:00:00 Sampling of data I need to insert in is as follow: 12/26/04 13:35 12/25/04 12:41 12/25/04 8:53 How do a massage that to the proper format YYY-MM-DD HH:MM:SS thanks -- - Scott Ha

Re: Date Functions in MySQL

2005-02-23 Thread Clarence
s 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(FRO

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 t

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(FRO

Date: Mon, 21 Feb 2005 16:14:05 +0000 To: From: Peter O'Brien Subject: Postcode Proximity Search? Message-Id:

2005-02-21 Thread Brandon Carter
Date: Mon, 21 Feb 2005 16:14:05 + To: From: Peter O'Brien <[EMAIL PROTECTED]> Subject: Postcode Proximity Search? Message-Id: <[EMAIL PROTECTED]> Hi I'm just starting out with PHP and MySQL My database has a postcode column and I want to be able to run a search

Re: Index key on yearweek(date)

2005-02-21 Thread Gleb Paharenko
#x27;m a bit new to MySQL, it's my first email to the list. > > Well, my question is: Can I have a key on a function of the column. > I have some table with a date column in it. I wish to have a key on > yearweek(datecolumn). I don't want to allow having duplicate weeks

Index key on yearweek(date)

2005-02-18 Thread Hany Nagaty
Hi all, I'm a bit new to MySQL, it's my first email to the list. Well, my question is: Can I have a key on a function of the column. I have some table with a date column in it. I wish to have a key on yearweek(datecolumn). I don't want to allow having duplicate weeks in the tab

Re: Filtering a date/time out of timestamp

2005-02-17 Thread Scott Hamm
Thanks to both of you, here is my string: select * from test where date(now())=substring(date,1,10); :) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

RE: Filtering a date/time out of timestamp

2005-02-17 Thread Jay Blanchard
[snip] I have been trying to figure out a way to filter a date out of timestamp to no success. How do I filter out specific critieria that I need using now()? [/snip] http://www.mysql.com/substring WHERE now() = substring(dateTimeColumnName, 1, 8) should get it -- MySQL General Mailing List

Filtering a date/time out of timestamp

2005-02-17 Thread Scott Hamm
I have been trying to figure out a way to filter a date out of timestamp to no success. How do I filter out specific critieria that I need using now()? -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: key on the month portion of a date field

2005-02-09 Thread Greg Fortune
) Then, add an index on that column and test your queries against the new index. I'd be surprised if you saw much increase in speed, especially as your data set grows. Greg On Wednesday 09 February 2005 09:17 am, Gabriel B. wrote: > Short Version: > is there any way to make an index

Re: key on the month portion of a date field

2005-02-09 Thread Gary Richardson
On Wed, 9 Feb 2005 15:17:36 -0200, Gabriel B. <[EMAIL PROTECTED]> wrote: > It is not too slow this way since i started the WHERE with lots of > checks that cuts down to a medium of 200 rows that actualy gets to > this check, but i feel uncorfotable to not use a index. Isn't there a limit of 1 ind

Re: key on the month portion of a date field

2005-02-09 Thread Paul DuBois
birthday between x and y". They're all full date values. It won't help except for queries that test the value of birthday directly. As soon as you use the column in a calculation such as a function call, the index can't be used. To use month in indexed fashion, you could s

Re: key on the month portion of a date field

2005-02-09 Thread Gabriel B.
On Wed, 09 Feb 2005 17:24:10 +, love <[EMAIL PROTECTED]> wrote: > alter table table_name add index (birthday); But would that index improve this kind of query? the docs talk about only direct matchs, like "birthday < now()" or" birthday between x and y&quo

Re: key on the month portion of a date field

2005-02-09 Thread love
use below: alter table table_name add index (birthday); Love Kumar .. [EMAIL PROTECTED] wrote: Short Version: is there any way to make an index for a date field that appears in the WHERE as a MONTH() argument? I have a table with some hundreds of thousands of rows already, and now i have the need

key on the month portion of a date field

2005-02-09 Thread Gabriel B.
Short Version: is there any way to make an index for a date field that appears in the WHERE as a MONTH() argument? I have a table with some hundreds of thousands of rows already, and now i have the need to show upcoming birthdays to some users. the query uses WHERE MONTH(birthday).. the

Re: Help with date query

2005-02-04 Thread SGreen
Jack Lauman <[EMAIL PROTECTED]> wrote on 02/04/2005 11:57:37 AM: > I want to run a nightly cron job where you iterate throught each row of > a single table and reset a field depending on the conditions specified. > In this case I want to take a date field (RenewalDate) and c

Help with date query

2005-02-04 Thread Jack Lauman
I want to run a nightly cron job where you iterate throught each row of a single table and reset a field depending on the conditions specified. In this case I want to take a date field (RenewalDate) and compare it to the current date less a 30 day grace period and if true reset the

Re: !! Help with query: Where Date = MAX(Date)

2005-02-04 Thread Michael Dykman
0050303 > > I need to get the latest Year,Month for a given date, so for example today > (20050204) I should retrieve 2005,01. > > As I'm using 4.0.20 I can't use subqueries so how can I create a query that > does this? > > SELECT year, mont

RE: !! Help with query: Where Date = MAX(Date)

2005-02-04 Thread Graham Cossey
> > As I'm using 4.0.20 I can't use subqueries so how can I create > a query that > > does this? > > > > SELECT year, month > > FROM `dc_months` > > WHERE start_date = (SELECT MAX(start_date) > > from dc_months > > where start_date <= '20050204') > >

Re: !! Help with query: Where Date = MAX(Date)

2005-02-04 Thread Philippe Poelvoorde
Graham Cossey wrote: Could someone please offer a little help. I have a table like: Year, Month, Start_date 20041020041102 20041120041203 20041220050104 20050120050204 20050220050303 I need to get the latest Year,Month for a given date, so for example today

!! Help with query: Where Date = MAX(Date)

2005-02-04 Thread Graham Cossey
Could someone please offer a little help. I have a table like: Year, Month, Start_date 20041020041102 20041120041203 20041220050104 20050120050204 20050220050303 I need to get the latest Year,Month for a given date, so for example today (20050204) I

Re: DATE problem

2005-02-01 Thread Michael Stassen
Mike Johnson wrote: From: René Fournier [mailto:[EMAIL PROTECTED] I'm trying to count rows that were added today. The column that I am counting on is in DATETIME format, so there are hours and minutes and seconds recorded, but I only need to check the date $sql = &q

RE: DATE problem

2005-02-01 Thread Mike Johnson
From: René Fournier [mailto:[EMAIL PROTECTED] > I'm trying to count rows that were added today. The column that I am > counting on is in DATETIME format, so there are hours and minutes and > seconds recorded, but I only need to check the date > > $

DATE problem

2005-02-01 Thread René Fournier
I'm trying to count rows that were added today. The column that I am counting on is in DATETIME format, so there are hours and minutes and seconds recorded, but I only need to check the date $sql = "SELECT COUNT(table.id)

Re: Date Conversion on Mysql 4.0.2

2005-01-28 Thread Sasha Pachev
Minh La wrote: Hi, Can some help me with a date conversion problme that I am having. I have a date data in the following format: 'Month Days Year Hour:Minute AM/PM' Example: 'Aug 21, 2004 2:00 PM' So far the hours that I have spent have been in vain. I tried using str_t

<    1   2   3   4   5   6   7   8   9   10   >