rhservan
asked on
How do I sum a count on nvarchar.
Current:
Select Company_Id ci, count (distinct Order_Number) cnt
From TableA
Having Count(Order_Number) >1
Order Number is a alpha numeric, example PQR0725102115, and is nvarchar.
Yields:
Ci cnt
1 10
2 2
3 6
4 15
Desired result:
I need the sum of the cnt column:
cnt
33
The problem is in the nvarchar.
Select Company_Id ci, count (distinct Order_Number) cnt
From TableA
Having Count(Order_Number) >1
Order Number is a alpha numeric, example PQR0725102115, and is nvarchar.
Yields:
Ci cnt
1 10
2 2
3 6
4 15
Desired result:
I need the sum of the cnt column:
cnt
33
The problem is in the nvarchar.
ASKER
Hey dsacker thanks for the help.
After implementing your solution I still get
Ci cnt
1 10
2 2
3 6
4 15
I need just one row sum result on cnt:
cnt
33
After implementing your solution I still get
Ci cnt
1 10
2 2
3 6
4 15
I need just one row sum result on cnt:
cnt
33
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try this:
Open in new window
I added the "AS" simply for readability.