Replacing the zero with next same id's value - MySQL

SdafsdfD

New Member
I used another table and generated a MySQL views, by using that view I coded the below:\[code\]SELECT staffid, CASE Frequency WHEN 'Less' THEN COUNT(Frequency) ELSE '0' END AS LessCount, CASE Frequency WHEN 'Full' THEN COUNT(Frequency) ELSE '0' END AS FullCount, CASE Frequency WHEN 'More' THEN COUNT(Frequency) ELSE '0' END AS MoreCountFROM effort_frequencyGROUP BY staffid, Frequency\[/code\]I used the above code to get the below table:\[code\]+-------+-----------+-----------+-----------+| staff | lessCount | FullCount | MoreCount |+-------+-----------+-----------+-----------+| 10 | 2 | 0 | 0 || 10 | 0 | 1 | 0 || 10 | 0 | 0 | 3 || 11 | 1 | 0 | 0 || 11 | 0 | 3 | 0 |+-------+-----------+-----------+-----------+\[/code\]I need this to be converted, which should look like:\[code\]+-------+-----------+-----------+-----------+| staff | lessCount | FullCount | MoreCount |+-------+-----------+-----------+-----------+| 10 | 2 | 1 | 3 || 11 | 1 | 3 | 0 |+-------+-----------+-----------+-----------+\[/code\]How we can do this in MySQL ?
 
Back
Top