Avatar of NO_CARRIER
NO_CARRIER

asked on 

SQL - Find Original Values Only

I know this solution must already exist somewhere, I just don't know how to word it.

What is the syntax for SQL (in ms-access) to find each original value.

For example, say I have a column in my  table named FirstName, and in the column I have the values:
John
John
John
Lisa
Mary
Mary
Bob
Bob
Bob
Bob
Bob

I want the SQL query to just select the first instance of each person's name... so it will return:
John
Lisa
Mary
Bob

... any help is appreciated..

NC
SQL

Avatar of undefined
Last Comment
Sean Stuber
ASKER CERTIFIED SOLUTION
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of rickchild
rickchild
Flag of United Kingdom of Great Britain and Northern Ireland image

An alternative is to use GROUP BY Firstname at the end of the statement.
SOLUTION
Avatar of Sean Stuber
Sean Stuber

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of NO_CARRIER
NO_CARRIER

ASKER

sdstuber: sorry my wording was misleading... the reason I said "first" is because that's the SQL operator I was experimenting with instead of distinct.  There is nothing significant from row to row... :)

thank you all for your assistance... DISTINCT is what I needed...

+++ath0
NO CARRIER
Avatar of Sean Stuber
Sean Stuber

no problem,  glad we could help
SQL
SQL

SQL (Structured Query Language) is designed to be used in conjunction with relational database products as of a means of working with sets of data. SQL consists of data definition, data manipulation, and procedural elements. Its scope includes data insert, query, update and delete, schema creation and modification, and data access control.

61K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo