MySQL Forums
Forum List  »  Newbie

Re: Recycling Database
Posted by: Peter Brawley
Date: April 02, 2018 02:41PM

Depends on the required logic, eg the 60th day of the year is 1 Mar except in leap years, when it's 29 Feb.

Or you could just create a table with 366 rows setting a column called monthday=0101...0131, 0201...0229 etc through 1201...1231, then for a given date @d write ...

insert into tbl set value = ...
where monthday=concat( substr( @d, 6, 2 ), right( @d, 2 ) );

But 100 years of values would only give 36,600 rows, which is a small table, so I don't understand the concern about table size.



Edited 1 time(s). Last edit at 04/02/2018 02:42PM by Peter Brawley.

Options: ReplyQuote


Subject
Written By
Posted
April 02, 2018 11:38AM
April 02, 2018 11:51AM
April 02, 2018 01:19PM
Re: Recycling Database
April 02, 2018 02:41PM


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.