MySQL Forums
Forum List  »  MySQL Workbench

Re: Update Previous Value and replace null to previous value
Posted by: Ben Lin
Date: May 07, 2014 11:55AM

At first, it is a pivot issue. You can get the first result by:


select jo_date, count(*) as totalJoborder,
count(case when jo_status='A' then 1 end) as A,
count(case when jo_status='B' then 1 end) as B,
count(case when jo_status='C' then 1 end) as C
from joborder group by jo_date;

google "mysql pivot", you will see that because mysql doesn't support pivot operation internally, you have to list the "A", "B", "C"...

Save the first result into a temp table, then the increment numbers can be done by joining itself and comparing the jo_date.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Update Previous Value and replace null to previous value
565
May 07, 2014 11:55AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.