MySQL Forums
Forum List  »  Newbie

Trying to add 1 day to a date in MySQL SQL Language
Posted by: Peter Nolan
Date: May 20, 2005 01:44PM

Hi All,
I have a table as follows:

create table dwh.dw_batch_control
( pk_batch_number integer not null primary key
, batch_date datetime not null
, batch_complete_flag integer not null
)
;

At the start of a batch I insert a new record with the day moved forward one day and the batch complete flag set 0...this row then acts as a semaphor to stop accidental re-processing....

The SQL I have tried which works on various other databases is as follows but, alas, none of them work.

Could anyone please tell me where to find the date manipulation functions of MySQL? I am new to MySQL...

Thanks

Peter Nolan
www.peternolan.com



select MAX(pk_batch_number) + 1 , MAX(batch_date) + 1 day, 0 from dwh.dw_batch_control ;
select MAX(pk_batch_number) + 1, dateadd(day,1,MAX(batch_date)), 0 from dwh.dw_batch_control ;
select MAX(pk_batch_number) + 1, MAX(batch_date) + 1, 0 from dwh.dw_batch_control ;

Options: ReplyQuote


Subject
Written By
Posted
Trying to add 1 day to a date in MySQL SQL Language
May 20, 2005 01:44PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.