Google Answers Logo
View Question
 
Q: Basic PL SQL question ( Answered 5 out of 5 stars,   0 Comments )
Question  
Subject: Basic PL SQL question
Category: Computers > Programming
Asked by: bbsch1245-ga
List Price: $2.50
Posted: 20 Oct 2003 16:58 PDT
Expires: 19 Nov 2003 15:58 PST
Question ID: 268084
What is the PLSQL command that will count the unique entries in a
column?

So if the table has this column ACCOUNT
ACCOUNT
1
1
2
3

The answer would be 3.
I tried "Select count unique ACCOUNT from table" and that didn't work
"Select unique ACCOUNT from TABLE" works to list all the unique ones,
but I just want the count of unique ones.

Thanks.
Answer  
Subject: Re: Basic PL SQL question
Answered By: andyt-ga on 20 Oct 2003 17:24 PDT
Rated:5 out of 5 stars
 
Hi bbsch1245-ga,

You were close with your try of "Select count unique ACCOUNT from
table"

The proper format is "Select count(distinct ACCOUNT) from table"

Research technique:
sql select count
sql select count(*)

A great sql tutorial can be found at http://www.w3schools.com/sql .  
I reference it all the time.  In addition, an example of select count
can be found at http://forums.devshed.com/t58759/s.html

If you need a clarification, don't hesitate to ask,
andyt-ga
bbsch1245-ga rated this answer:5 out of 5 stars
Thanks!  I especially appreciate the pointer to the sql tutorial.  If
there's a tutorial specifically for Oracle PL Sql do let me know. 
Thanks,

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy