Solved

SQL query Axcess

Posted on 2009-04-15
3
292 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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
SQL Command Tool comes with APEX under SQL Workshop. It helps us to make changes on the database directly using a graphical user interface. This helps us writing any SQL/ PLSQL queries and execute it on the database and we can create any database ob…
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…

813 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

19 Experts available now in Live!

Get 1:1 Help Now