Select Distinct access 2003 Query

I need to modify the query below to only show distinct values in the number field, in other words if there are 25 records showing the number 50 in the number field i only want it to show the number 50 once,

SELECT tblDetailVideos.Id, tblDetailVideos.txtName, tblDetailVideos.Number
FROM tblDetailVideos;
mickeyshelley1Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gustav BrockCIOCommented:
This should do:

SELECT DISTINCT
    tblDetailVideos.txtName, tblDetailVideos.Number
FROM
    tblDetailVideos;

/gustav
0
Dale FyeCommented:
The problem with DISTINCT queries is that it will only return DISTINCT combinations of fields.  So if you want all of those other fields in the result set, you may still get duplicates from the [Number] field.

The syntax is simple, simply add DISTINCT as the predicate to the list of fields:

SELECT DISTINCT Field1, Field2, FieldN
FROM yourTable
0
PatHartmanCommented:
If you don't care what the values for the other two fields are, Group by may solve the problem.

SELECT First(tblDetailVideos.Id) As FirstID, First(tblDetailVideos.txtName) As FirstName, tblDetailVideos.Number
 FROM tblDetailVideos
Group By tblDetailVideos.Number;
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PatHartmanCommented:
My answer solves the problem.  Using the Group By, you can get  a single instance of the requested column and the "first" instance of the other fields.  The Distinct keyword would only work if all instances of the additional columns had no variations.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.