MySQL Update Value of column Based on DATE

tasos.kou

I have a database problem with MySQL I created a database with a table CustomerInfo enter image description here

Every year i want to update kilometers plus 1000

For example the row 6 today should be updated to 7000 kilometers from 6000 and the date from 2013-08-06 to 2014-08-06

update database.CustomerInfo 
set Kilometers = Kilometers + 1000
where date_add(Date, interval 1 year) = curdate();

This code isn't correct and the date update is missing

If i run query

select * from database.customerinfo where date_add(Date, interval 1 year) = curdate();

returns row 6

thanks for the help

Abhik Chakraborty

Date update is missing since you are not updating the date

update database.CustomerInfo 
set Kilometers = Kilometers + 1000, Date = curdate()
where date_add(Date, interval 1 year) = curdate();

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Update column value in XTS object based on date

From Dev

UPDATE sql column with value from another column based on a date column

From Dev

Update value in a column based on another column in the same table in MYSQL

From Dev

Update value in column based on column count in another table with mysql

From Dev

Update column in one table based on value in another table in mysql

From Dev

Update column in one table based on value in another table in mysql

From Dev

Update a column based on the value of other column

From Dev

Update column with previous record based on date

From Dev

Stored procedure to update column based on Min Date

From Dev

MySQL - JOIN based on value of column?

From Dev

How to merge create a column in R that only take one value based on update date

From Dev

MySQL update column which is a value in another column

From Dev

MySQL update column which is a value in another column

From Dev

Update value based on the previous updated value mysql

From Dev

How To Update The Date Based On Previous Record Value

From Dev

How To Update The Date Based On Previous Record Value

From Dev

PHP: Update MySQL entry based on certain date

From Dev

update time to date-time column in MySQL

From Dev

Update Date column with adding 10 days in mysql

From Dev

Update a column based on its current value

From Dev

Update first header column based on checkbox value

From Dev

mysql update based on time stamp in another column

From Dev

get max date based on column value

From Dev

Incrementally update date field column based on order of a second column

From Dev

can't update date value MySQL python

From Dev

Update minimum values based on another value - MySql

From Dev

mysql random update date column between two date with condition

From Dev

MySQL update column value with max value from another column

From Dev

Update value in mysql database column with checkbox in php

Related Related

  1. 1

    Update column value in XTS object based on date

  2. 2

    UPDATE sql column with value from another column based on a date column

  3. 3

    Update value in a column based on another column in the same table in MYSQL

  4. 4

    Update value in column based on column count in another table with mysql

  5. 5

    Update column in one table based on value in another table in mysql

  6. 6

    Update column in one table based on value in another table in mysql

  7. 7

    Update a column based on the value of other column

  8. 8

    Update column with previous record based on date

  9. 9

    Stored procedure to update column based on Min Date

  10. 10

    MySQL - JOIN based on value of column?

  11. 11

    How to merge create a column in R that only take one value based on update date

  12. 12

    MySQL update column which is a value in another column

  13. 13

    MySQL update column which is a value in another column

  14. 14

    Update value based on the previous updated value mysql

  15. 15

    How To Update The Date Based On Previous Record Value

  16. 16

    How To Update The Date Based On Previous Record Value

  17. 17

    PHP: Update MySQL entry based on certain date

  18. 18

    update time to date-time column in MySQL

  19. 19

    Update Date column with adding 10 days in mysql

  20. 20

    Update a column based on its current value

  21. 21

    Update first header column based on checkbox value

  22. 22

    mysql update based on time stamp in another column

  23. 23

    get max date based on column value

  24. 24

    Incrementally update date field column based on order of a second column

  25. 25

    can't update date value MySQL python

  26. 26

    Update minimum values based on another value - MySql

  27. 27

    mysql random update date column between two date with condition

  28. 28

    MySQL update column value with max value from another column

  29. 29

    Update value in mysql database column with checkbox in php

HotTag

Archive