Group By Count records in SQL Server

nabilabolo
 
on Nov 17, 2022 01:26 AM
187 Views

Hi,

I have 3 order which each order has 3 services.

I want to count the service that Family = Mercury as 1 not 3 as they are under the same order.

How can i do it under SQL Server?

Order : 12345

Service (Family) : Service1(Mercury) , service2(Mercury),

service3(Mercury)

order : 18999

Service(Family) : Service4(Mercury) , service5(Mercury),

service6(Mercury)

order : 20000

Service(Family) : Service4(Sunny) , service5(Sunny),

service6(Sunny)

Download FREE API for Word, Excel and PDF in ASP.Net: Download
Andrea
 
on Nov 17, 2022 01:26 AM
Hi @nabilabolo,
Please try the following

Count number or record from each Group in SQL Server

It might help you.

Cheers Andrea.