473,379 Members | 1,253 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Distinct Count Multiple Fields

Hi I'm trying to return a count for distinct value for 2 fields. So for example

1 2
bat hat
book store
bat hat
book room
dark room
bat hat

I would want it to return the Number 4 because there are four distinct combinations

Thanks
Jun 25 '07 #1
1 2166
JConsulting
603 Expert 512MB
Hi I'm trying to return a count for distinct value for 2 fields. So for example

1 2
bat hat
book store
bat hat
book room
dark room
bat hat

I would want it to return the Number 4 because there are four distinct combinations

Thanks

Expand|Select|Wrap|Line Numbers
  1.  
  2. Select Count([Field1]) as MyCount
  3. from MyTable
  4. Group By
  5. Field1, Field2;
  6.  
  7.  
Jun 25 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Dean | last post by:
I want to build query to return how many rows are in this query: select distinct c1, c2 from t1 But SQL won't accept this syntax: select count (distinct c1, c2) from t1 Does someone know how...
1
by: none | last post by:
Hello there, I have a table with many text and varchar fields and I would like to get all distinct words from these filelds. For example: table Pet: id int(10) unsigned legende text
2
by: Anne Heddal | last post by:
In the first line I'm trying to count the the unqiue values of the ID column, but I'm getting syntax error, any idea how to format the distinct count? SELECT Count(test.ID) AS IDCOUNT FROM...
1
by: nfrodsham | last post by:
In Microsoft's help literature, it states: "You can filter out non-unique rows by using the DISTINCT option of an aggregate function" I am trying to do this in Access 2003 with the COUNT...
5
by: Fred Zuckerman | last post by:
Can someone explain the difference between these 2 queries? "Select Distinct id, account, lastname, firstname from table1" and "Select DistinctRow id, account, lastname, firstname from table1" ...
4
by: dubing | last post by:
Hello everyone, I've tried both DISTINCT or DISTINCTROW in the following query in a PHP script. But the results still contain duplicate records as show below. DISTINCT works fine on single...
4
by: tom booster | last post by:
Hi All, I'm trying to convert a T-SQl query to DB2. I have two tables policy and policyHolder. I would like a count of the amount of distinct poicyHolders per policy, for a particular set of...
17
by: ukchat | last post by:
I.m creating a dynamic query to pull out workbooks from my database the table structure is below. Table: curricworkbooks Columns: ID, curric, assessment, topic, workbook, filename Example data...
3
by: alienz747 | last post by:
Hi, I have a query which is supposed to count distinct fields but it doesn't work properly. It does not count the unique values of the PayrollNumber. It counts all values. Any ideas why? Thanks....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.