Best forum for MySQL expertise
| User, date | Message |
|---|---|
|
Written by kez
3 years ago Category: General 20 posts since Tue, 21 Sep 10 |
I have a table called pay. It has a column called date with many yyyy-mm-dd records. I wish to test pay.date with the following MS Excel VBA function and then insert the result of the function in another column called week. I would be very grateful for an implementation in MySQL so i can run it in HeidiSQL. Which is the best forum for MySQL ? Function Week_w(av) Dim dd, fy, m, y, d m = Month(av) y = Year(av) d = Day(av) fy = y If m * 100 + d < 406 Then fy = fy - 1 dd = DateSerial(y, m, d) - DateSerial(fy, 4, 6) week_w = Int(dd \ 7 + 1) End Function Kez |
|
Written by ansgar
3 years ago 3975 posts since Fri, 07 Apr 06 |
I guess your week column shall contain the week number (1-53)? In that case it's so easy you should not store that redundant data into a new column, just select date with a format function when you need the week: SELECT DATE_FORMAT(`date`, '%u') FROM pay mysql-docs wrote: |
|
Written by kez
3 years ago 20 posts since Tue, 21 Sep 10 |
Thanks Anse, I have not got to grips with computation in mySQL yet and cannot find a web page to show me so i need a rather full solution having grappled with that one over anumber of hours. Is there a forum somewhere ? Many Thanks for all your help, it is kindly appreciated |
|
Written by ansgar
3 years ago 3975 posts since Fri, 07 Apr 06 |
http://forums.mysql.com/ |
|
Please login to leave a reply, or register at first. |