Is there any function for reprent final day of year in mysql

SasinduRHN

i want to add all sum of values of reg_data3 table of column rainfall to average_mas_curve table column year of last year and all of values in past data of previous years as a summation but i want to represent as a function of last day of year please give me it.......help me. e.g y-12-31.

INSERT INTO mas_aver_curve (year, cumulative) 
    SELECT '2013-12-31', ROUND(SUM(rainfall), 1) rainfall 
    FROM reg_data3 G 
    WHERE date >= '2008-01-01' AND date <  '2013-12-31'
Filipe Silva

You could try:

INSERT INTO mas_aver_curve (year, cumulative) 
    SELECT STR_TO_DATE(CONCAT(year(NOW())-1,'-12-31'),'%Y-%m-%d') AS LastDay, 
           ROUND(SUM(rainfall), 1) rainfall 
    FROM reg_data3 G 
    WHERE date >= '2008-01-01' AND date <  '2013-12-31'
    GROUP BY 1;

sqlfiddle demo for the str_to_date part

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Get First and Last Day of Any Year

From Dev

Mysql YEAR function not supported?

From Dev

PHP strtotime Function: first day of this year

From Dev

PHP strtotime Function: first day of this year

From Dev

MySQL Select last day of current year

From Dev

MySQL Calculate age by year month and day

From Java

MySQL Query GROUP BY day / month / year

From Dev

MYSQL Comparing previous year by same week day

From Dev

MySQL Calculate age by year month and day

From Dev

SQL Filter Out Specific Month, Day, and Time for Any Year

From Dev

SQL Filter Out Specific Month, Day, and Time for Any Year

From Dev

How can I combine fixed month and day with sql year function?

From Dev

compare dates in mysql where the day, month and year are stored separately

From Dev

cast string of day-month-year to date in mysql

From Dev

Mysql Count and Split to DAY, WEEK, YEAR for Statistics in same query

From Dev

Select all rows from start of the year, month, week and day in MySQL?

From Dev

In PHP & MySQL Display date in day month Year Format from database

From Dev

Any alternative to MONTH() and YEAR() functions which are common to both MySQL and PostgreSQL

From Dev

Date based on day of year + year

From Dev

PHP MySQL Table w AJAX: Filling in data for the whole year (day by day, only showing 7 days at once)

From Dev

Assign day of the day year to a month

From Dev

how to get day month and year of any post from WP post object?Wordpress

From Dev

Convert day of year to date

From Dev

Oracle Julian day of year

From Dev

Excel Count Day and Year

From Dev

Finding day of the year

From Dev

Convert day of the year to date

From Dev

NSDate day of the year (swift)

From Dev

mysql - How to get if day past of any data in SELECT

Related Related

  1. 1

    Get First and Last Day of Any Year

  2. 2

    Mysql YEAR function not supported?

  3. 3

    PHP strtotime Function: first day of this year

  4. 4

    PHP strtotime Function: first day of this year

  5. 5

    MySQL Select last day of current year

  6. 6

    MySQL Calculate age by year month and day

  7. 7

    MySQL Query GROUP BY day / month / year

  8. 8

    MYSQL Comparing previous year by same week day

  9. 9

    MySQL Calculate age by year month and day

  10. 10

    SQL Filter Out Specific Month, Day, and Time for Any Year

  11. 11

    SQL Filter Out Specific Month, Day, and Time for Any Year

  12. 12

    How can I combine fixed month and day with sql year function?

  13. 13

    compare dates in mysql where the day, month and year are stored separately

  14. 14

    cast string of day-month-year to date in mysql

  15. 15

    Mysql Count and Split to DAY, WEEK, YEAR for Statistics in same query

  16. 16

    Select all rows from start of the year, month, week and day in MySQL?

  17. 17

    In PHP & MySQL Display date in day month Year Format from database

  18. 18

    Any alternative to MONTH() and YEAR() functions which are common to both MySQL and PostgreSQL

  19. 19

    Date based on day of year + year

  20. 20

    PHP MySQL Table w AJAX: Filling in data for the whole year (day by day, only showing 7 days at once)

  21. 21

    Assign day of the day year to a month

  22. 22

    how to get day month and year of any post from WP post object?Wordpress

  23. 23

    Convert day of year to date

  24. 24

    Oracle Julian day of year

  25. 25

    Excel Count Day and Year

  26. 26

    Finding day of the year

  27. 27

    Convert day of the year to date

  28. 28

    NSDate day of the year (swift)

  29. 29

    mysql - How to get if day past of any data in SELECT

HotTag

Archive