خرید بک لینک

Vote count: 0

I have a query that gets unit count and it tagging if completed or not.

SELECT distinct location, 
case when  id is NULL then 'Not Started'
 when '1'  then 'Completed' 
 else 'In Progress' end   as Remarks,
count(name) as CountName
FROM table
group by location,
case when  id is NULL then 'Not Started'
 when '1'  then 'Completed' 
 else 'In Progress' end;

Result:

enter image description here

But I want to summarized this as below image:

enter image description here

Condition is when there are more that two(2) Remarks in Location it should be tagged as "In-progress" and sum the CountName. But when only one Remarks for a Location, gets the Remarks as its tagged.

asked 41 secs ago

برچسب: نویسنده: استخدام کار تاريخ: سه شنبه 12 مرداد 1395 ساعت: 11:27

صفحه بندی