Auto add days to datetime as each days passes in mysql -


i want make column in mysql database when user login first time in system, stores datetime in mysql table. , since day in other column days add according register date. 1, 2, 3,....and on. so, there way can achieve results? please guide me soon.

you can 1 column (to hold registration / first login date) , datediff function:

create table users (   id int(11) not null auto_increment,   name varchar(20) not null,   registered_at datetime not null,   primary key (id) );  insert users set name = 'myname', registered_at = now();  select registered_at, datediff(now(), registered_at) days_since users name = 'myname'; 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -