Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
divan
Posting Yak Master
153 Posts |
Posted - 2013-08-23 : 15:05:24
|
I have a table that has two columns POLICY_NUMBER and POLICY_TYPEPOLICY_NUMBER POLICY-TYPE123 1123 1123 1567 2567 2789 1789 1345 1345 1345 1I need to write a script that give me the following resultpolicy_type_count policy_type3 11 1 |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2013-08-23 : 15:30:33
|
quote: Originally posted by divan I have a table that has two columns POLICY_NUMBER and POLICY_TYPEPOLICY_NUMBER POLICY-TYPE123 1123 1123 1567 2567 2789 1789 1345 1345 1345 1I need to write a script that give me the following resultpolicy_type_count policy_type3 11 1
SELECT COUNT(DISTINCT policy_number) AS policy_type_count, [policy-type]FROM YourTableGROUP BY [policy-type] |
 |
|
divan
Posting Yak Master
153 Posts |
Posted - 2013-08-23 : 18:55:05
|
James you must have forgotten to include your script |
 |
|
|
|
|