From DATE_FORMAT and back to origin date in mysql date column

2013-07-24 Thread Karl-Arne Gjersøyen
SELECT DATE_FORMAT(dato, '%e/%c/%Y') AS dato FROM transportdokument WHERE
dato = '2013-07-20' AND dato = '2013-07-24' GROUP BY dato DESC is working
perfect in my PHP file.

But I need to transfer the date back from my norwegian formatted date to
the origin date format in WHERE dato = '$standard_date_format';

What need I do to fix this?

Thanks for your time and help to learn me programming!

Karl


RE: From DATE_FORMAT and back to origin date in mysql date column

2013-07-24 Thread Rick James
I'm unclear on your task, but maybe this function will help:
http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_str-to-date

(It is confusing to have dato as both a column name and an alias.)

 -Original Message-
 From: Karl-Arne Gjersøyen [mailto:karlar...@gmail.com]
 Sent: Wednesday, July 24, 2013 7:02 AM
 To: MySQL Mailinglist
 Subject: From DATE_FORMAT and back to origin date in mysql date column
 
 SELECT DATE_FORMAT(dato, '%e/%c/%Y') AS dato FROM transportdokument WHERE
 dato = '2013-07-20' AND dato = '2013-07-24' GROUP BY dato DESC is
 working perfect in my PHP file.
 
 But I need to transfer the date back from my norwegian formatted date to
 the origin date format in WHERE dato = '$standard_date_format';
 
 What need I do to fix this?
 
 Thanks for your time and help to learn me programming!
 
 Karl

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: Is there any determined date for mysql 6 release?

2008-01-20 Thread Sebastian Mendel

legolas schrieb:

Hi
Thank you for reading my post
Is there any  scheduled date mysql 6 release?


don't know


I heard that it is based on falcon and can perform better...


based on in the wrong term, MyISAM will still be the default storage 
engine, it just adds Falcon as a new storage engine


http://dev.mysql.com/doc/refman/6.0/en/storage-engine-overview.html

--
Sebastian

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Is there any determined date for mysql 6 release?

2008-01-19 Thread legolas

Hi
Thank you for reading my post
Is there any  scheduled date mysql 6 release?
I heard that it is based on falcon and can perform better...

Thanks.
-- 
View this message in context: 
http://www.nabble.com/Is-there-any-determined-date-for-mysql-6-release--tp14968233p14968233.html
Sent from the MySQL - General mailing list archive at Nabble.com.


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



How to emulate a DATE() in MySQL 4.0?

2007-11-03 Thread mikesz
Hello mysql,

I have a PHP script that I have written and it runs beautifully on
current MySQL and PHP sites BUT, it barfs on MySQL 4.0 because I am
using the DATE() to extract the Date from a timestamp. Does anyone
remember how to do an equivalent function in 4.0? I have searched
through hundreds of pages and can not find anything that looks like it
might work. Essentially I need to extract the -MM-DD from a
timestamp field that I populated in a PHP script so I can do a diff
against a current timestamp.

Here is the query that works on current and falls over dead on 4.0:

SELECT count(SimulatedTimeSet) as count_live FROM `Simulator`
WHERE DATE( `SimulatedTimeSet` ) = DATE(CURRENT_TIMESTAMP)

I appreciate in advance any clue to get me in the right directions
other than upgrading the system. I don't have any control over that
one...

TIA
-- 
Best regards,
 mikesz  mailto:[EMAIL PROTECTED]


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: How to emulate a DATE() in MySQL 4.0?

2007-11-03 Thread Baron Schwartz

[EMAIL PROTECTED] wrote:

Hello mysql,

I have a PHP script that I have written and it runs beautifully on
current MySQL and PHP sites BUT, it barfs on MySQL 4.0 because I am
using the DATE() to extract the Date from a timestamp. Does anyone
remember how to do an equivalent function in 4.0? I have searched
through hundreds of pages and can not find anything that looks like it
might work. Essentially I need to extract the -MM-DD from a
timestamp field that I populated in a PHP script so I can do a diff
against a current timestamp.

Here is the query that works on current and falls over dead on 4.0:

SELECT count(SimulatedTimeSet) as count_live FROM `Simulator`
WHERE DATE( `SimulatedTimeSet` ) = DATE(CURRENT_TIMESTAMP)


Try FROM_UNIXTIME().

Have you read the manual section on date and time functions?  There are 
quite a few.  You don't need to read hundreds of pages.


http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html

Baron

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



ddmmyyyy-format date hangs MySQL - 5.0.22/InnoDB/WinXP-SP2

2006-08-16 Thread Asif Lodhi

Hi,

In my earlier post, I was making a mistake (though I didn't do so in
the posted text!) - I was passing the dob (the date field) in the
ddmm format.  When I passed the date field in mmdd format, the
stored procedure ran fine and the record got inserted.  The problem is
MySQL hangs/goes in limbo quitely instead of throwing back an error.
Certainly smells like a bug. ???

I have psted the text of my original post at the end of this message.

--
Asif






I have the following database objects in a purely InnoDB database:

-- 

CREATE TABLE Person (

  PersonIDint not null PRIMARY KEY,

  Ttl char(15),

  FllNm   varchar(50),

  frstNm  varchar(15) not null,

  midNm   varchar(15),

  lstNm   varchar(15) not null,

  Gender  char(1) not null DEFAULT 'M' CHECK
Gender in ('M','F'),

  dob dateCHECK DOB  '19000101',

  nicNo   varchar(13),

  mrtlSttschar(1) not null DEFAULT 'M' CHECK
mrtlStts in ('S','M','D','W'),

  cellNo  varchar(15),

  website varchar(80),

  Sttsint not null DEFAULT 1, /*
1=Active, 2=Inactive */

  index PersonDob_ndx (dob),

  index PersonNIC_ndx (nicno),

  index PersonCell_ndx (cellNo),

  index PersonFllNm_ndx (FllNm),

  index PersonNm_ndx (frstNm, midNm, lstNm)

) ENGINE=InnoDB;







CREATE FUNCTION CharValIsNumeric (v VARCHAR(15))

  RETURNS boolean

BEGIN

  declare i, l int(2);

  set l=char_length(v);

  set i=1;

  while (i = l) and (substring(v,i,1) in
('1','2','3','4','5','6','7','8','9','0')) do

  set i=i+1;

  end while;

  IF i  l THEN

  return 1;

  else

  return 0;

  end if;

END;





create procedure PersonAdd (Ttl_char(15),

  frstNm_ varchar(15),

  midNm_  varchar(15),

  lstNm_  varchar(15),

  Gender_ char(1),

  dob_char(8),/* mmdd */

  nicNo_  varchar(13),

  mrtlStts_   char(1),

  cellNo_ varchar(15),

  website_varchar(80),

  machine_no_ int)

begin

  insert into Person (PersonID, Ttl, frstNm, midNm, lstNm, Gender, dob,
nicNo, mrtlStts,

  cellNo, website)

  select  (machine_no_ * 100) + (CASE WHEN ((max(PersonID)) -

  ((max(PersonID) div 100) * 100)) is null Then

  0

  ELSE

  ((max(PersonID)) - ((max(PersonID) div 100)
* 100))

  END) + 1 as PersonID, Ttl_, frstNm_, midNm_, lstNm_,
Gender_, dob_, nicNo_,

  mrtlStts_, cellNo_, website_

  from Person;

end;







create trigger Person_Check_bi

  before insert on Person

  for each row

begin

  if new.gender  'M' and new.gender  'F'  then

  set @errmsg = 'Gender value not equal to either M or F';

  insert into tmp1 (checkCol) values (1);

  end if;



  if new.dob  '19000101' then

  set @errmsg = 'Date of birth set far back in time!
Less than 1900';

  insert into tmp1 (checkCol) values (1);

  end if;



  if new.mrtlStts  'S' and

  new.mrtlStts  'M' and

  new.mrtlStts  'D' and

  new.mrtlStts  'W' then



  set @errmsg = 'Marital Status not equal to one of
S,M,D,W - Single,
Married, Divorced and Widowed';

  insert into tmp1 (checkCol) values (1);

  end if;



  if CharValIsNumeric (ltrim(rtrim(new.nicno)))=0 then

  set @errmsg = 'NIC No contains non-numeric characters';

  insert into tmp1 (checkCol) values (1);

  end if;



  if CharValIsNumeric (ltrim(rtrim(new.cellno)))=0 then

  set @errmsg = 'Cell/Mobile No contains non-numeric characters';

  insert into tmp1 (checkCol) values (1);

  end if;

end;



create trigger Person_Check_bu

  before update on Person

  for each row

begin

  if new.gender  'M' and new.gender  'F'  then

  set @errmsg = 'Gender value not equal to either M or F';

  insert into tmp1 (checkCol) values (1);

  end if;



  if new.dob  '19000101' then

  set @errmsg = 'Date of birth set far back in time!
Less than 1900';

  insert into tmp1 (checkCol) values (1);

Converting date in MySQL

2004-10-14 Thread Stuart Felenstein
Hi,
I am taking user input via a calendar widget (guess
it's js)

Apparently, mysql does not like the format
MM/DD/
Then again I tried it around , still no dice.
It's intended to go into a Date column.  

Is there a way I can correct it right within my query
?

Stuart

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Converting date in MySQL

2004-10-14 Thread Jeff Smelser
On Thursday 14 October 2004 02:45 pm, Stuart Felenstein wrote:

 Apparently, mysql does not like the format
 MM/DD/
 Then again I tried it around , still no dice.
 It's intended to go into a Date column.

http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html

All, you every need to know if right there..

Jeff


pgpS5L2p8iK4l.pgp
Description: PGP signature


Re: Converting date in MySQL

2004-10-14 Thread Stuart Felenstein
Thanks , I know the page and have the links
bookmarked!

Stuart

--- Jeff Smelser [EMAIL PROTECTED] wrote:

 On Thursday 14 October 2004 02:45 pm, Stuart
 Felenstein wrote:
 
  Apparently, mysql does not like the format
  MM/DD/
  Then again I tried it around , still no dice.
  It's intended to go into a Date column.
 

http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html
 
 All, you every need to know if right there..
 
 Jeff
 

 ATTACHMENT part 2 application/pgp-signature 



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Converting date in MySQL

2004-10-14 Thread Jeff Smelser
On Thursday 14 October 2004 03:12 pm, Stuart Felenstein wrote:
 Thanks , I know the page and have the links
 bookmarked!

So you got the answer from it right?

Jeff


pgpSsmcBOJscM.pgp
Description: PGP signature


Re: Converting date in MySQL

2004-10-14 Thread Stuart Felenstein
No :),. cause it seems that those formats are for
outbound, db -.
I was looking for the other direction.

Stuart
--- Jeff Smelser [EMAIL PROTECTED] wrote:

 On Thursday 14 October 2004 03:12 pm, Stuart
 Felenstein wrote:
  Thanks , I know the page and have the links
  bookmarked!
 
 So you got the answer from it right?
 
 Jeff
 

 ATTACHMENT part 2 application/pgp-signature 



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Converting date in MySQL

2004-10-14 Thread Jeff Smelser
On Thursday 14 October 2004 03:35 pm, Stuart Felenstein wrote:
 No :),. cause it seems that those formats are for
 outbound, db -.
 I was looking for the other direction.

Huh? It really doesnt matter does it? They work either way..

I use those functions all the time for inbound..

Jeff


pgpssSczCg1j2.pgp
Description: PGP signature


Re: Converting date in MySQL

2004-10-14 Thread SGreen
For values headed into a SQL statement, use whatever functions are 
available to you in the language (PHP, PERL, Python, Java, VB Script,...) 
you are using to accept the user's input in order to make the commands you 
send MySQL correct.  You just need to convert the date into -MM-DD 
hh:nn:ss format and MySQL will be as happy as a clam.

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine



Stuart Felenstein [EMAIL PROTECTED] wrote on 10/14/2004 04:35:21 PM:

 No :),. cause it seems that those formats are for
 outbound, db -.
 I was looking for the other direction.
 
 Stuart
 --- Jeff Smelser [EMAIL PROTECTED] wrote:
 
  On Thursday 14 October 2004 03:12 pm, Stuart
  Felenstein wrote:
   Thanks , I know the page and have the links
   bookmarked!
  
  So you got the answer from it right?
  
  Jeff
  
 
  ATTACHMENT part 2 application/pgp-signature 
 
 
 
 -- 
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
 


Re: Converting date in MySQL

2004-10-14 Thread Jeff Smelser
On Thursday 14 October 2004 03:46 pm, [EMAIL PROTECTED] wrote:
 For values headed into a SQL statement, use whatever functions are
 available to you in the language (PHP, PERL, Python, Java, VB Script,...)
 you are using to accept the user's input in order to make the commands you
 send MySQL correct.  You just need to convert the date into -MM-DD
 hh:nn:ss format and MySQL will be as happy as a clam.

That, or str_to_date will work nicely for what he is looking for.. Which was 
my point.. 

Jeff


pgpXlFpQANUPu.pgp
Description: PGP signature


RE: Converting date in MySQL

2004-10-14 Thread Mike Johnson
From: Jeff Smelser [mailto:[EMAIL PROTECTED] 

 On Thursday 14 October 2004 03:35 pm, Stuart Felenstein wrote:
  No :),. cause it seems that those formats are for
  outbound, db -.
  I was looking for the other direction.
 
 Huh? It really doesnt matter does it? They work either way..
 
 I use those functions all the time for inbound..

It does matter, though. You can't use DATE_FORMAT() to translate
'10/14/2004' into '2004-10-14.'

It looks like what the poster wants is STR_TO_DATE() (a la
STR_TO_DATE('10/14/2004', '%m/%d/%Y'), but that's not available until
MySQL 4.1.1.

Out of curiosity, how /would/ you do this? I'm assuming you're not using
STR_TO_DATE() (as I didn't even know it existed until I just checked),
though I may be incorrect.

As the last poster said, if you're not using 4.1.1, you're better off
setting the format in the calling script. You'd assumedly need to do
some error-checking, anyway.


-- 
Mike Johnson Smarter Living, Inc.
Web Developerwww.smarterliving.com
[EMAIL PROTECTED]   (617) 886-5539


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Converting date in MySQL

2004-10-14 Thread Jeff Smelser
On Thursday 14 October 2004 04:00 pm, Mike Johnson wrote:
 It does matter, though. You can't use DATE_FORMAT() to translate
 '10/14/2004' into '2004-10-14.'

No, your right, that would be wrong.

 It looks like what the poster wants is STR_TO_DATE() (a la
 STR_TO_DATE('10/14/2004', '%m/%d/%Y'), but that's not available until
 MySQL 4.1.1.

Yeah.. 

 Out of curiosity, how /would/ you do this? I'm assuming you're not using
 STR_TO_DATE() (as I didn't even know it existed until I just checked),
 though I may be incorrect.

I did.. And its there.. but he didn't say that wasnt an option, just that he 
didn't see anything think for inbound.. I was saying there was.. If he doesnt 
have the version, its left to the client.. which he didn't specify.

My answers can only be as good as the questions.. He left a lot open..

Jeff


pgpowCDfiCISX.pgp
Description: PGP signature


Release date for MySQL 4.1 Official verison

2004-09-23 Thread Petrus Venter - Hetzner Africa
Does anybody know what the planned release date is for MySQL 4.1 
Official release (not Gamma).

--
Petrus Venter
Hetzner Africa
Tel: +27 21 970 2000
Fax: +27 21 970 2001
Email Disclaimer: http://www.hetzner.co.za/index.php?id=245
[ * Awarded Top 50 ICT Company in South Africa for the period 2003/4 by the Corporate 
Research Foundation]
[ * Named National Top 300 High Growth Companies by DTI for the period 2004/5]
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Problems using date with MySQL 4.1.0 - Alpha

2003-12-14 Thread Lenny Sorey
I am currently using MySQL 4.1 Win2K version along ODBC 3.5.1 Driver

I am having trouble using the following LOAD DATA INFILE to import a txt, comma 
delimited file into to a Mysql Table.

Actually the only problem is the date field loading into mysql 4.1.

I have defined the field as a date, datetime and timestamp. 

Where I am having trouble is the date in the second group below. I am receiving the 
information as 
12/06/2003.  All fields load fine with the exception of the 12/06/2003 field.

All I get is is -00-00 00:00:00 for the value of this field.

Can anyone point me to the right direction on how I can successfully load the date 
with the 12/06/2003 format without
getting -00-00 00:00:00 everytime.

Thanks for your help and time.

Lenny Sorey



LOAD DATA INFILE d:/mydir/myfile.Tmp INTO TABLE dealervehicle
FIELDS TERMINATED BY ',' ENCLOSED BY '' ESCAPED BY '\\' LINES TERMINATED BY '\n';
(CIDLOTD,CVIN,CSTOCKNUM,CDISPOSITI,CMAKE,CMODEL,CYEAR,CMILEAGE,CBODYTYPE,CENGINE,CENGINESIZ,CINDUCTION,CTRANSMISS,
CCOLOR,CPRICE,CCOST,CWARRANTY,CWARRANTYT,FWARRANTY,FWARRANTYT,FWARRANTYC,CPC_LABOR,CPC_PARTS,CWARRMONTH,C
WARRMILES,CMANUF_MON,CMANUF_YEA,CSERVICEAG,DDATE_IN,DDATE_REMO,O1,O2,O3,O4,O5,O6,O7,O8,O9,O10,O11,O12,O13,O14,O15,O1
6,O17,O18,O19,O20,O21,O22,O23,O24,O25,O26,O27,O28,O29,O30,O31,O32,O33,O34,O35);




Dealer Name,2FMZA5145YBC70950,6641,A,FORD,Windstar LX,2000,65969,MINI 
VAN,V-6,3.8,SEQUENTIAL-PORT 
F.I.,AUTOMATIC WITH OVERDRIVE,Red, , ,Y,L,C1, , 
,50,50,90,3000,08,1999,Y,12/06/2003,/  /,POWER 
STEERING,POWER BRAKES,POWER DOOR LOCKS,POWER WINDOWS,AM/FM STEREO 
RADIO,CASSETTE PLAYER,RADIAL 
TIRES,GAUGE CLUSTER,TRIP ODOMETER,TACHOMETER,AIR CONDITIONING,TILT STEERING 
WHEEL,CRUISE 
CONTROL,TINTED GLASS,DRIVER SIDE AIR BAG,PASSENGER SIDE AIR BAG,RECLINING 
SEATS,,ALLOY WHEELS,BODY-SIDE 
MOLDING,LUGGAGE RACK,CLOCK,INTERVAL WIPERS,REAR DEFROSTER,REAR WINDOW 
WIPER,CONSOLE,CARPETING,DAY/NIGHT LEVER,DUAL SPORT MIRRORS,DRIVER SIDE 
REMOTE MIRROR,FRONT BUCKET 
SEATS,CLOTH UPHOLSTERY,THIRD SEAT,CENTER ARM REST,COURTESY LIGHTS







-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Problems using date with MySQL 4.1.0 - Alpha

2003-12-14 Thread Paul DuBois
At 18:10 -0600 12/14/03, Lenny Sorey wrote:
I am currently using MySQL 4.1 Win2K version along ODBC 3.5.1 Driver

I am having trouble using the following LOAD DATA INFILE to import a 
txt, comma delimited file into to a Mysql Table.

Actually the only problem is the date field loading into mysql 4.1.

I have defined the field as a date, datetime and timestamp.

Where I am having trouble is the date in the second group below. I 
am receiving the information as
12/06/2003.  All fields load fine with the exception of the 
12/06/2003 field.
MySQL expects dates to be formatted in year-month-day order.  If you
check the values that you think loaded successfully, my guess is that you
will find they didn't really.
All I get is is -00-00 00:00:00 for the value of this field.

Can anyone point me to the right direction on how I can successfully 
load the date with the 12/06/2003 format without
getting -00-00 00:00:00 everytime.

Thanks for your help and time.

Lenny Sorey


--
Paul DuBois, Senior Technical Writer
Madison, Wisconsin, USA
MySQL AB, www.mysql.com
Are you MySQL certified?  http://www.mysql.com/certification/

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Importing diff format date to MySQL

2002-10-11 Thread Sankaranarayanan Mahadevan

Hi,

I have data in CSV format file which has a date value
in the format 'dd/mm/yy'?
When i used 'Load data...' to import to a MySQL table,
all the fields gets the value from the file except the
date field that contains the date of birth??
is there any way to format and import???

Thanks
Regards
Shankar

__
Do you Yahoo!?
Faith Hill - Exclusive Performances, Videos  More
http://faith.yahoo.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




re: Importing diff format date to MySQL

2002-10-11 Thread Egor Egorov

Sankaranarayanan,
Friday, October 11, 2002, 7:15:30 AM, you wrote:

SM I have data in CSV format file which has a date value
SM in the format 'dd/mm/yy'?
SM When i used 'Load data...' to import to a MySQL table,
SM all the fields gets the value from the file except the
SM date field that contains the date of birth??
SM is there any way to format and import???

No, you can't.
http://www.mysql.com/doc/en/Using_DATE.html



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /Egor Egorov
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
   ___/   www.mysql.com




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




re: The Release date of MySQL 4.1

2002-09-23 Thread Egor Egorov

andykychan,
Monday, September 23, 2002, 11:16:09 AM, you wrote:

a I would like to know when the MySQL 4.1 will be released.

a We are looking forwards to hearing from you.

It will come in alpha before this year ends.



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /Egor Egorov
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
   ___/   www.mysql.com




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




sysdate or curdate as default date in mysql

2002-09-02 Thread Chugh Shalini

Dear All!
Can we define sysdate or curdate as default date for a column of
datatype 'date' while creating a table?

Regards

Sql, mysql, query


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: sysdate or curdate as default date in mysql

2002-09-02 Thread Mike Hillyer

If what you are looking for is the current date to be used as date of
creation, then remain unchanged, you will have to specify sysdate as a value
during an insert. You may benefit from the timestamp datatype, which sets
itself to the current date when any DML statements (insert, update) are
performed.

Mike


-Original Message-
From: Chugh Shalini [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 02, 2002 6:41 AM
To: [EMAIL PROTECTED]
Subject: sysdate or curdate as default date in mysql


Dear All!
Can we define sysdate or curdate as default date for a column of
datatype 'date' while creating a table?

Regards

Sql, mysql, query


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: sysdate or curdate as default date in mysql

2002-09-02 Thread DL Neil

Dear Chugh,

 Can we define sysdate or curdate as default date for a column of
 datatype 'date' while creating a table?


The question is ambiguous:

- if a table is created with a column defined to be a TIMESTAMP data type,
then every time a row is INSERTed or UPDATEd, the current date will be
entered into the field (a two-edged sword!).

- if you want to define the date/time under which MySQL is running, eg run
it as if the server was in London instead of India, then the way to do that
is to run the whole serverPC with such a system clock setting.

- if you want the table's creation date/time to be the default value for a
particular column, then I think you will have to hard-code that as a literal
value into the column definition within CREATE TABLE (I don't think it is
possible to ask MySQL to evaluate and plug in the time value for you)

Have you studied the manual?
Regards,
=dn



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: sysdate or curdate as default date in mysql

2002-09-02 Thread Egor Egorov

Chugh,
Monday, September 02, 2002, 3:41:27 PM, you wrote:

CS Can we define sysdate or curdate as default date for a column of
CS datatype 'date' while creating a table?

You can't define result of function as a default value.
Take a look at TIMESTAMP column type:
 http://www.mysql.com/doc/en/DATETIME.html





-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /Egor Egorov
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
   ___/   www.mysql.com



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: sysdate or curdate as default date in mysql

2002-09-02 Thread Chugh Shalini

Thankx for the reply Egorov,Hillyer and Neil. 
Timestamp has solved my purpose.

Actually we are porting an application from oracle to mysql. In Oracle there
were some tables which were using sysdate as default date, therefore we
wanted something similar functionality, as it was very difficult to make
changes in code of such a large application 

According to Neil my question was little ambiguous, but inspite of that the
answers replied by all of you had helped me in solving my query.




-Original Message-
From:   Egor Egorov [SMTP:[EMAIL PROTECTED]]
Sent:   Monday, September 02, 2002 9:31 PM
To: [EMAIL PROTECTED]
Subject:Re: sysdate or curdate as default date in mysql

Chugh,
Monday, September 02, 2002, 3:41:27 PM, you wrote:

CS Can we define sysdate or curdate as default date for a
column of
CS datatype 'date' while creating a table?

You can't define result of function as a default value.
Take a look at TIMESTAMP column type:
 http://www.mysql.com/doc/en/DATETIME.html

 -Original Message-
 From: Mike Hillyer [SMTP:[EMAIL PROTECTED]]
 Sent: Monday, September 02, 2002 6:54 PM
 To:   Chugh Shalini; [EMAIL PROTECTED]
 Subject:  RE: sysdate or curdate as default date in mysql
 
 If what you are looking for is the current date to be used as date of
 creation, then remain unchanged, you will have to specify sysdate as a
 value
 during an insert. You may benefit from the timestamp datatype, which sets
 itself to the current date when any DML statements (insert, update) are
 performed.
 
 Mike
 
 
-Original Message-
From:   DL Neil [SMTP:[EMAIL PROTECTED]]
Sent:   Monday, September 02, 2002 7:15 PM
To: Chugh Shalini; [EMAIL PROTECTED]
Subject:Re: sysdate or curdate as default date in mysql

Dear Chugh,

 Can we define sysdate or curdate as default date for a column of
 datatype 'date' while creating a table?


The question is ambiguous:

- if a table is created with a column defined to be a TIMESTAMP data
type,
then every time a row is INSERTed or UPDATEd, the current date will
be
entered into the field (a two-edged sword!).

- if you want to define the date/time under which MySQL is
running, eg run
it as if the server was in London instead of India, then the way to
do that
is to run the whole serverPC with such a system clock setting.

- if you want the table's creation date/time to be the default value
for a
particular column, then I think you will have to hard-code that as a
literal
value into the column definition within CREATE TABLE (I don't think
it is
possible to ask MySQL to evaluate and plug in the time value for
you)

Have you studied the manual?
Regards,
=dn

 -Original Message-
 From: Chugh Shalini [mailto:[EMAIL PROTECTED]]
 Sent: Monday, September 02, 2002 6:41 AM
 To: [EMAIL PROTECTED]
 Subject: sysdate or curdate as default date in mysql
 
 
 Dear All!
   Can we define sysdate or curdate as default date for a column of
 datatype 'date' while creating a table?
 
 Regards
 
 Sql, mysql, query
 
 
 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)
 
 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail
 [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
 
 
 
 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)
 
 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail
 [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Date and Mysql...

2002-04-10 Thread Chuck \PUP\ Payne

Hi again...

When I felt proud because last week I had asked about how to use NOW(), and
get answer that got me working, but now I have a strange problem. It listing
dates, but it not listing like it should, when the web page is create it
going 9, 8, 5, 10 on the dates. Here is the SQL statement I am using...


SELECT DATE_FORMAT(DATE, '%M %D, %Y') AS DATE, Title, Links, Summary FROM
news WHERE TO_DAYS(NOW()) - TO_DAYS(DATE) =5 ORDER BY DATE DESC

Another problem I am having with another statement. The following statement
should list birthdays that are 7 days out but it not...

SELECT DATE_FORMAT(DOB, '%M %D, %Y') as DOB, Fname, Lname, Email FROM
emply_info WHERE (TO_DAYS(DOB) - TO_DAYS(NOW()))
=5 AND (TO_DAYS(DOB) = TO_DAYS(NOW())) and Tdate is NULL and DOB is not
null ORDER BY DOB, Lname

Any clue why my SQL statement worked once are now not working?

Thanks a head of time.

Chuck Payne
Magi Design and Support



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: Date and Mysql...

2002-04-10 Thread Christian Pfeiffer

 Hi again...

Hi,
 
 When I felt proud because last week I had asked about how to 
 use NOW(), and
 get answer that got me working, but now I have a strange 
 problem. It listing
 dates, but it not listing like it should, when the web page 
 is create it
 going 9, 8, 5, 10 on the dates. Here is the SQL statement I 
 am using...
 
 
 SELECT DATE_FORMAT(DATE, '%M %D, %Y') AS DATE, Title, Links, 
 Summary FROM
 news WHERE TO_DAYS(NOW()) - TO_DAYS(DATE) =5 ORDER BY DATE DESC

Date_format returns a string, so 10 is indeed below 5.

You could try something like



 Another problem I am having with another statement. The 
 following statement
 should list birthdays that are 7 days out but it not...
 
 SELECT DATE_FORMAT(DOB, '%M %D, %Y') as DOB, Fname, Lname, Email FROM
 emply_info WHERE (TO_DAYS(DOB) - TO_DAYS(NOW()))
 =5 AND (TO_DAYS(DOB) = TO_DAYS(NOW())) and Tdate is NULL 
 and DOB is not
 null ORDER BY DOB, Lname
 
 Any clue why my SQL statement worked once are now not working?
 
 Thanks a head of time.
 
 Chuck Payne
 Magi Design and Support
 
 
 
 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)
 
 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail 
 [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
 
 


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Date and Mysql...

2002-04-10 Thread Gerald Clark

Your alias and column name are the same.
Which one do you think is being tested?

Also DATE is a reserved word.

Chuck \PUP\ Payne wrote:

Hi again...

When I felt proud because last week I had asked about how to use NOW(), and
get answer that got me working, but now I have a strange problem. It listing
dates, but it not listing like it should, when the web page is create it
going 9, 8, 5, 10 on the dates. Here is the SQL statement I am using...


SELECT DATE_FORMAT(DATE, '%M %D, %Y') AS DATE, Title, Links, Summary FROM
news WHERE TO_DAYS(NOW()) - TO_DAYS(DATE) =5 ORDER BY DATE DESC

Another problem I am having with another statement. The following statement
should list birthdays that are 7 days out but it not...

SELECT DATE_FORMAT(DOB, '%M %D, %Y') as DOB, Fname, Lname, Email FROM
emply_info WHERE (TO_DAYS(DOB) - TO_DAYS(NOW()))
=5 AND (TO_DAYS(DOB) = TO_DAYS(NOW())) and Tdate is NULL and DOB is not
null ORDER BY DOB, Lname

Any clue why my SQL statement worked once are now not working?

Thanks a head of time.

Chuck Payne
Magi Design and Support



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail 
[EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php





-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




FW: Date and Mysql... (now complete)

2002-04-10 Thread Christian Pfeiffer

(one should not mess up strg and shift :-/)

 Hi again...

Hi,
 
 When I felt proud because last week I had asked about how to 
 use NOW(), and
 get answer that got me working, but now I have a strange 
 problem. It listing
 dates, but it not listing like it should, when the web page 
 is create it
 going 9, 8, 5, 10 on the dates. Here is the SQL statement I 
 am using...
 
 
 SELECT DATE_FORMAT(DATE, '%M %D, %Y') AS DATE, Title, Links, 
 Summary FROM
 news WHERE TO_DAYS(NOW()) - TO_DAYS(DATE) =5 ORDER BY DATE DESC

Date_format returns a string, so 10 is indeed below 5.

You could try something like

SELECT DATE, DATE_FORMAT(DATE, '%M %D, %Y') AS DATE2, Title, Links, 
Summary FROM
news WHERE TO_DAYS(NOW()) - TO_DAYS(DATE) =5 ORDER BY DATE DESC

 Another problem I am having with another statement. The 
 following statement
 should list birthdays that are 7 days out but it not...
 
 SELECT DATE_FORMAT(DOB, '%M %D, %Y') as DOB, Fname, Lname, Email FROM
 emply_info WHERE (TO_DAYS(DOB) - TO_DAYS(NOW()))
 =5 AND (TO_DAYS(DOB) = TO_DAYS(NOW())) and Tdate is NULL 
 and DOB is not
 null ORDER BY DOB, Lname

Similar thing. Date_format(NULL, '%M %D, %Y') should return 00 00, 00,
iirc, and thus is not NULL even if your date column is.  

SELECT DOB, DATE_FORMAT(DOB, '%M %D, %Y') as DOB2, Fname, Lname, Email
FROM
emply_info WHERE (TO_DAYS(DOB) - TO_DAYS(NOW()))
=5 AND (TO_DAYS(DOB) = TO_DAYS(NOW())) and Tdate is NULL 
and DOB is not
null ORDER BY DOB, Lname

 Any clue why my SQL statement worked once are now not working?
 
 Thanks a head of time.
 
 Chuck Payne
 Magi Design and Support

HTH,

Chris 


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Date and Mysql...

2002-04-10 Thread Alexander Skwar

»Chuck PUP Payne« sagte am 2002-04-10 um 10:27:19 -0400 :
 going 9, 8, 5, 10 on the dates. Here is the SQL statement I am using...

That's because your DATE which you've made with DATE_FORMAT is treated
as string.  To fix it, I'd write:

 SELECT DATE_FORMAT(DATE, '%M %D, %Y') AS DATE, Title, Links, Summary FROM
 news WHERE TO_DAYS(NOW()) - TO_DAYS(DATE) =5 ORDER BY DATE DESC

SELECT DATE_FORMAT(DATE, '%M %D, %Y') AS DATE_DSP, DATE, Title, Links, Summary FROM
news WHERE TO_DAYS(NOW()) - TO_DAYS(DATE) =5 ORDER BY DATE DESC

This way, you can display the nicely formated date in DATE_DSP and
still got a good copy of date around.

Alexander Skwar
-- 
How to quote:   http://learn.to/quote (german) http://quote.6x.to (english)
Homepage:   http://www.iso-top.de  | Jabber: [EMAIL PROTECTED]
   iso-top.de - Die günstige Art an Linux Distributionen zu kommen
   Uptime: 21 hours 52 minutes

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Simple: Date Stamp mySQL and PHP

2002-01-24 Thread Shannon Kendrick

Hi all, 
Ive got a timestamp in a database column and basically
I was wondering if there was any function in PHP to
parse the date into something more readable from 

20020123143547

23 Jan 2002 14:35

something like 

$date1= datetoreadable($date);


Thanks

Shannon


__
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions! 
http://auctions.yahoo.com

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Simple: Date Stamp mySQL and PHP

2002-01-24 Thread Marcus Müller

Hi,

have a look at http://www.php.net/manual/en/function.date.php

According to your example, it would be something like:
?php
$date1=date(d M Y H:i, 20020123143547);
?

Regards
Marcus

 Ive got a timestamp in a database column and basically
 I was wondering if there was any function in PHP to
 parse the date into something more readable from 
 
 20020123143547
 
 23 Jan 2002 14:35
 
 something like 
 
 $date1= datetoreadable($date);



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Simple: Date Stamp mySQL and PHP

2002-01-24 Thread DL Neil

What's this? PHP on the MySQL list - such heresy!!!

Do not pass go, go directly to: 
http://www.mysql.com/doc/D/a/Date_and_time_functions.html

=dn


- Original Message -
From: Marcus Müller [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 24 January 2002 11:17
Subject: Re: Simple: Date Stamp mySQL and PHP


 Hi,

 have a look at http://www.php.net/manual/en/function.date.php

 According to your example, it would be something like:
 ?php
 $date1=date(d M Y H:i, 20020123143547);
 ?

 Regards
 Marcus

  Ive got a timestamp in a database column and basically
  I was wondering if there was any function in PHP to
  parse the date into something more readable from
 
  20020123143547
 
  23 Jan 2002 14:35
 
  something like
 
  $date1= datetoreadable($date);



 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail 
[EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Simple: Date Stamp mySQL and PHP

2002-01-24 Thread Marcus Müller

Oops,
got it all wrong. Thought it was a real timestamp, but it's already
the date, only formatted in a different way.

The date() function expects a Unix-timestamp as its second argument.
Thus you could try to leave the conversion to MySQL by using
UNIX_TIMESTAMP(your_timestamp_column) or if you want to do it in PHP use
mktime().

http://www.php.net/manual/en/function.mktime.php

?php
$date1=20020123143547;
$date1_year=substr($date1, 0, 4);
$date1_month=substr($date1, 4, 2);
$date1_day=substr($date1, 6, 2);
$date1_hour=substr($date1, 8, 2);
$date1_minute=substr($date1, 10, 2);
$date1_second=substr($date1, 12, 2);
$date=date(d M Y H:i, mktime($date1_hour, $date1_minute,
$date1_second, $date1_month, $date1_day, $date1_year);
?

Hope that helps
Marcus

 have a look at http://www.php.net/manual/en/function.date.php

 According to your example, it would be something like:
 ?php
 $date1=date(d M Y H:i, 20020123143547);
 ?



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Can I use the concept of Effective Date with MySQL?

2001-11-02 Thread Rich Duzenbury

I've got the same issue that you do.  Here is my thinking thus far:

Say I have a transaction table:
Record_Key
Service_Date
Item_Code
Item_Quantity

I'm considering this structure for the rate table:
Item_Code
Effective_Date
Rate

It's practical from a data entry perspective, but I can't seem to write a 
single query that says 'join the transaction table to the rate table where 
Service_Date = Effective_Date, and only get the latest rate record for 
each item_code'.  The assumption here is that there is only a record added 
to the table when a new rate is about to be implemented.  Of course, one 
could use client side logic and multiple queries to get the desired result.

It's more likely I'll wind up with this kind of rate table:
Item_Code
Effective_Date_From
Effective_Date_Thru
Rate

At least then, I can join by item code and use a where clause to restrict 
the transaction service date to be within the effective date range.  The 
only issue here is that I'll need quite good control over the data entry 
process to be sure that date ranges never overlap, or the join mechanism 
could return more than one rate record, and perhaps cause an incorrect result.

I have also considered a somewhat novel alternative, which is to use the 
first table structure, but use it to build a table that has each and every 
day populated for each item.  That way, an exact join could always be made 
by Item Code and Service Date.  The drawback here is that it wastes a lot 
of space just to make a convenient join.  1000 items for one year would 
require 365,000 records, a considerable waste of space.

If anyone has a more reasonable idea, please add to the discussion.

Regards,
Rich

At 07:52 PM 11/1/01, Alejandro Zuzenberg wrote:
I need to select the appropriate price for a product in a table, and the
product has a compund key with 2 fields: product number and date.
For every transaction with a certain product, I need to retrieve the price
that was 'current' at the specific time when that transaction took place.

In joining two tables, I need to relate the price of a product to every
sales transaction where that product was used, not only by product number
but also by the effective date for that price.

How can  I do this? Is there a 'closest' function (the highest value that is
 or = ) to be used in a WHERE statment ?
I've been searching for this for hours and could not fnd a solution with
MySql.


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Can I use the concept of Effective Date with MySQL?

2001-11-01 Thread Alejandro Zuzenberg

I need to select the appropriate price for a product in a table, and the
product has a compund key with 2 fields: product number and date.
For every transaction with a certain product, I need to retrieve the price
that was 'current' at the specific time when that transaction took place.

In joining two tables, I need to relate the price of a product to every
sales transaction where that product was used, not only by product number
but also by the effective date for that price.

How can  I do this? Is there a 'closest' function (the highest value that is
 or = ) to be used in a WHERE statment ?
I've been searching for this for hours and could not fnd a solution with
MySql.

Thanks!
Alejandro
[EMAIL PROTECTED]


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: Can I use the concept of Effective Date with MySQL?

2001-11-01 Thread Rick Emery

SELECT price FROM mytable WHERE price = theprice DESC LIMIT 1;

-Original Message-
From: Alejandro Zuzenberg [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 01, 2001 7:53 PM
To: [EMAIL PROTECTED]
Subject: Can I use the concept of Effective Date with MySQL?


I need to select the appropriate price for a product in a table, and the
product has a compund key with 2 fields: product number and date.
For every transaction with a certain product, I need to retrieve the price
that was 'current' at the specific time when that transaction took place.

In joining two tables, I need to relate the price of a product to every
sales transaction where that product was used, not only by product number
but also by the effective date for that price.

How can  I do this? Is there a 'closest' function (the highest value that is
 or = ) to be used in a WHERE statment ?
I've been searching for this for hours and could not fnd a solution with
MySql.

Thanks!
Alejandro
[EMAIL PROTECTED]


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: Can I use the concept of Effective Date with MySQL?

2001-11-01 Thread William R. Mussatto

I have had to do this problem and i solved it by having 4 fields, 
Normalprice (PrPrice),
Tempprice (PrTempPrice),
Start date (PrStart)
End Date (PrStop).

In the select 

IF(((CURDATE() = PRStart) and (PRStop = CURDATE())), 
PrTempPrice, PrPrice) as CurrentPrice

hope this helps


On Thu, 1 Nov 2001, Rick Emery wrote:

 Date: Thu, 1 Nov 2001 17:20:00 -0600 
 From: Rick Emery [EMAIL PROTECTED]
 To: 'Alejandro Zuzenberg' [EMAIL PROTECTED], [EMAIL PROTECTED]
 Subject: RE: Can I use the concept of Effective Date with MySQL?
 
 SELECT price FROM mytable WHERE price = theprice DESC LIMIT 1;
 
 -Original Message-
 From: Alejandro Zuzenberg [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, November 01, 2001 7:53 PM
 To: [EMAIL PROTECTED]
 Subject: Can I use the concept of Effective Date with MySQL?
 
 
 I need to select the appropriate price for a product in a table, and the
 product has a compund key with 2 fields: product number and date.
 For every transaction with a certain product, I need to retrieve the price
 that was 'current' at the specific time when that transaction took place.
 
 In joining two tables, I need to relate the price of a product to every
 sales transaction where that product was used, not only by product number
 but also by the effective date for that price.
 
 How can  I do this? Is there a 'closest' function (the highest value that is
  or = ) to be used in a WHERE statment ?
 I've been searching for this for hours and could not fnd a solution with
 MySql.
 
 Thanks!
 Alejandro
 [EMAIL PROTECTED]
 
 
 _
 Do You Yahoo!?
 Get your free @yahoo.com address at http://mail.yahoo.com
 
 
 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)
 
 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
 
 
 
 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)
 
 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
 

Sincerely,

William Mussatto, Senior Systems Engineer
CyberStrategies, Inc
ph. 909-920-9154 ext. 27


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




european date to mysql date

2001-09-11 Thread Max

Hi,
I need to transform a europe date like 10/09/2001 (dd/mm/) in this
format: 2001/09/10 (/mm/dd) ... how can I do using the mysql functions?

many thanks in advance
max




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




How can one validate a date in mysql ?

2001-05-15 Thread Vankeerberghen, Pieter

Dear Colleagues,
 
How can one validate a date in mysql ?
 
Kind regards,
Pieter



Re: How can one validate a date in mysql ?

2001-05-15 Thread Colin Faber

Validate a date?

see Date and Time functions in the manual.


Vankeerberghen, Pieter wrote:
 
 Dear Colleagues,
 
 How can one validate a date in mysql ?
 
 Kind regards,
 Pieter

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: How can one validate a date in mysql ?

2001-05-15 Thread Vankeerberghen, Pieter

Thank you, Ok, I looked in the manual but I coul dnot obtain an answer. How
can I check that a date I'm importing is valid, e.g. how to check for
20001131 (MMDD) ?

Kind regards,
Pieter

-Original Message-
From: Colin Faber [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 15, 2001 11:18 AM
To: Vankeerberghen, Pieter
Cc: [EMAIL PROTECTED]
Subject: Re: How can one validate a date in mysql ?


Validate a date?

see Date and Time functions in the manual.


Vankeerberghen, Pieter wrote:
 
 Dear Colleagues,
 
 How can one validate a date in mysql ?
 
 Kind regards,
 Pieter



Re: How can one validate a date in mysql ?

2001-05-15 Thread Peter Pentchev

On Tue, May 15, 2001 at 11:27:19AM +0200, Vankeerberghen, Pieter wrote:
 Thank you, Ok, I looked in the manual but I coul dnot obtain an answer. How
 can I check that a date I'm importing is valid, e.g. how to check for
 20001131 (MMDD) ?

You'll have to do this kind of validation checks in your actual program
that uses the MySQL interface, *before* executing the SQL statement itself.

G'luck,
Peter

-- 
yields falsehood, when appended to its quotation. yields falsehood, when appended to 
its quotation.

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: How can one validate a date in mysql ?

2001-05-15 Thread Paul van den Berg

 Dear Colleagues,
  
 How can one validate a date in mysql ?
  
 Kind regards,
 Pieter

The simplest way that i know is:
 date_add(datestring, interval 0 day) 
This function wil return the correct date or NULL with months outside 1..12 
and days outside 1..31.
Here are some examples:
select date_add('1999023', interval 0 day) - null
select date_add('19990223', interval 0 day) -1999-02-23
select date_add('19990232', interval 0 day) - null
select date_add('19990231', interval 0 day) -1999-03-03 

Regards, Paul


Paul B. van den Berg   email: [EMAIL PROTECTED]
Department of Social Pharmacy and Pharmacoepidemiology
University Centre for Pharmacy tel:31-50-361 fax:31-50-3632772
Ant. Deusinglaan 1  9713 AV Groningen  Netherlands

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php