Dec 5, 2007 #1 learnfox2 Technical User Joined Jul 10, 2007 Messages 5 Location US Hello, if I want a total count on all unique values in a specific field what is the command? I rememeber something like count(*) for fieldname..... or something like that. Keep in mind I only want to count each line once. Thanks
Hello, if I want a total count on all unique values in a specific field what is the command? I rememeber something like count(*) for fieldname..... or something like that. Keep in mind I only want to count each line once. Thanks
Dec 5, 2007 #2 DSummZZZ Programmer Joined Oct 24, 2000 Messages 4,250 Location US Try: Code: SELECT somefield, COUNT(somefield) as nHowmany FROM sometable; GROUP BY somefield; ORDER BY somefield -Dave Summers- Even more Fox stuff at: http://www.davesummers.net/foxprolinks.htm Upvote 0 Downvote
Try: Code: SELECT somefield, COUNT(somefield) as nHowmany FROM sometable; GROUP BY somefield; ORDER BY somefield -Dave Summers- Even more Fox stuff at: http://www.davesummers.net/foxprolinks.htm
Dec 5, 2007 #3 TamarGranor Programmer Joined Jan 26, 2005 Messages 2,488 Location US Are you trying to find out how many different values there are or how many there are of each value. Dave's answer tells you how many of each. For how many different values, try: Code: SELECT COUNT(DISTINCT fieldname) AS UniqueValues ; FROM YourTable ; INTO CURSOR UniqueCount Tamar Upvote 0 Downvote
Are you trying to find out how many different values there are or how many there are of each value. Dave's answer tells you how many of each. For how many different values, try: Code: SELECT COUNT(DISTINCT fieldname) AS UniqueValues ; FROM YourTable ; INTO CURSOR UniqueCount Tamar