Can I get DISTINCT values on three fields?

# Thread: Can I get DISTINCT values on three fields?

1. Senior Member
Join Date
Dec 1969
Posts
817

## Can I get DISTINCT values on three fields?

2. Senior Member
Join Date
Dec 1969
Posts
96,118

## What are you after???

That will get you every distinct *COMBINATION* of the three fields.<BR><BR>But you could (and should!) certainly get records such as:<BR><BR>A P X<BR>A P Z<BR>A Q X<BR>A Q Z<BR>B P X<BR>B P Z<BR>B Q X<BR>B Q Z<BR>

3. Senior Member
Join Date
Dec 1969
Posts
2,885

## RE: Can I get DISTINCT values on three fields?

Yes you can.

4. Senior Member
Join Date
Dec 1969
Posts
2,885

## RE: What are you after???

Hey Bill, I was trying to come up with the proper terms to explain DISTINCT, but I couldn&#039;t. It does not pertain to a column, so I was going to say "row", but it is not the entire row, jsut the returned row. What is that old-school word again? "Tuple"? Would it be correct to say that DISTINCT pertains to a tuple and not a column. Do you know what I mean?

5. Senior Member
Join Date
Dec 1969
Posts
817

## RE: What are you after???

I need a list of offices and departments but if I don&#039;t do DISTINCT then if 25 people work in a department I will see that department name 25 times. Same with office.

6. Senior Member
Join Date
Dec 1969
Posts
817

## How???

.

7. Senior Member
Join Date
Dec 1969
Posts
96,118

## Tuple or row...

...after all, nobody says that a returned row has to come from a single table or contain all the fields/columns of the table.<BR><BR>Heck, I can do<BR> SELECT 1,2,3<BR>and get a row returned.<BR><BR>But I do like your suggestion of "tuple". It seems to cover all the bases.<BR><BR>

8. Senior Member
Join Date
Dec 1969
Posts
96,118

## 3 queries then...

...though you might find a way to use a DataSet or DataTable and perform an in-memory filter/select on it. Dunno.<BR><BR>

9. Senior Member
Join Date
Dec 1969
Posts
96,118

## I want to hear this answer, too...

.<BR>

10. Senior Member
Join Date
Dec 1969
Posts
2,885

## RE: How???

I dunno :-&#124 My "yes" was a reply to the correct interpretation of DISTINCT, like Bill and I replied about. You want something a little different. Try the Database Forum; I can&#039;t think SQL at the moment.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•