Solved

SQL query Axcess

Posted on 2009-04-15
3
269 Views
Last Modified: 2012-05-06
Dear Experts,
I'm using Axcess and I need to write and SQL script that should bring me
unique names and everything on the same line.

I have table which has collomns Name, Phone, Email

when I write SELECT  distinct TableName.Name
FROM TableName;
the result shows only the NAME, but I want to select disctinct only name but I want to see the related information that the name refers to.

For example if the the Name  Mr. Ancek Anderson is unique I want to see all the information about Mr. Ancek Anderson.

how should I write the sql script?

thank you in advance.
0
Comment
Question by:Braveheartli
  • 2
3 Comments
 
LVL 29

Accepted Solution

by:
David H.H.Lee earned 500 total points
ID: 24145658
Hi Braveheartli,
Try this:
SELECT  TableName.Name, TableName.Phone, TableName.Email

FROM TableName where exists(SELECT distinct TA.Name FROM TableName AS TA where TA.Name= TableName.Name) 

Open in new window

0
 
LVL 1

Author Comment

by:Braveheartli
ID: 24145714
thank you x_com
What does TA mean?
0
 
LVL 29

Expert Comment

by:David H.H.Lee
ID: 24145781
Hi Braveheartli,
TA mean alias or it is shorthand notation. You can declare it under different alias for each referred table and reuse it over your query easily. Beside that table alias also used to remove the ambiguity of the column names used in different tables especially if using in complex query.


0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now