here is the link of the related question Related question ,
Now i have a query which gives me the company name exactly as i want
QUERY
SELECT CASE WHEN COALESCE(b.totalCoupons, 0) > 3 THEN a.Name +'(Important) '
WHEN IsHighPriority = 1 THEN a.Name +'(High Priority) '
ELSE a.Name +''
END AS CompanyName
FROM Company a
LEFT JOIN
(
SELECT Name, COUNT(*) totalCoupons
FROM Company
GROUP BY Name
) b ON a.name = b.name
Now i want that In the scenario of (important)
we are testing that if company have more then 3 coupons then add (Important)
infront of Company name but i want to do that if
a company have more then 3 coupons where
RejectProcessed = 0 and ReviewVerify = 0 and isPublish = 0 and ForSupervisor = 0
then i want to add important infront of that particular company name . So , what should i do .
Please feel free to ask if you need any detail .
Thanks in advance
@user2193861, is Coupon present in left join with company table..?
This query solved my problem
Use this..