MySQL, incrementing a row count by ascending dates (simple?) -
i work in access cannot figure logic within it. i'm branching mysql in hopes can this.
have table visits customerid, visitdate
customerid visitdate 1001 7/6/2015 2315 9/1/2015 2315 12/30/2014 9851 5/5/2013 9851 1/7/2014 9851 3/21/2014 i'd add column called 'visit number' can label in ascending order each customer's visitdate first, second, etc...
it like:
customerid visitdate visitnumber 1001 7/6/2015 1 2315 9/1/2015 1 2315 12/30/2014 2 9851 5/5/2013 1 9851 1/7/2014 2 9851 3/21/2014 3 it's incrementation based on ascending dates, grouped customerid.
would appreciate tips on this. thanks.
ok. have query use update date whenever visits.
you want cause additional action @ point because equates increment of visits.
if i'm not incorrect, simple bundle of:
your update sql; update mytable set visitnumber = visitnumber + 1 customerid = (the id of user updating);
Comments
Post a Comment