Blog Stats
  • Posts - 10
  • Articles - 0
  • Comments - 1
  • Trackbacks - 0

 

Wednesday, February 25, 2009

SELECT COUNT DISTINCT


I found something really cool with SQL yesterday that I did not think it would do; give me the distinct count of a field. For example, to calculate the number of payment terms being used for our customers in the UK I can use the following statement: SELECT COUNT(DISTINCT [Payment Terms Code]) FROM [Customer] WHERE [Country_Region Code]='GB'
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati
 

 

Copyright © LEV