MySQL Forums
Forum List  »  Stored Procedures

Re: Displaying 6 Months starting from the one given
Posted by: conor meegan
Date: September 28, 2005 09:48AM

I am not entirely clear what you require here. Do you require a procedure/query which for a given SPECIFIC SINGLE date value, returns the subsequent 6 months.

You could create a new table containing a single datevalue field. You could then write a short procedure which takes a datevalue as an input and calculates the following 6 months and puts them into the new table. This should not be difficult to do, however, I am not sure if this is precisely what you need.

The function you need is

SELECT date_add(col_name, interval 1 month) FROM tbl_name;
SELECT date_add(col_name, interval 6 month) FROM tbl_name;

where col_name is the name of the column containing the dates you mentioned.

This function will deal with the change in the year naturally.

I hope this is of some help.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Displaying 6 Months starting from the one given
1867
September 28, 2005 09:48AM


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.