SiteExperts.com Logo Home | Community | Developer's Paradise
User Groups | Site Tools | Site Information | Search
 Main Menu
 Forums
SiteExperts.com Forums
All Discussions

SiteExperts Feedback
The Lounge
Dynamic HTML
Site Design/ Critiques
HTML and CSS
XML Technologies
The Wireless Internet
Internet Explorer
Microsoft .NET
The Server
Technical Support

Sponsored Links

User Groups : Forums : SiteExperts : The Server :

Previous DiscussionNext Discussion
 records with unique column data !

Hi ,

i want to select all the fields of a table with no duplicate firstName field !

table structure :

u_id , u_firstname , u_last name , u_address , u_tel

Started By vahid_reza on Mar 14, 2007 at 7:07:00 AM

5 Response(s) | Reply

Earlier Replies | Replies 2 to 5 of 5 | Later Replies
brian on Mar 14, 2007 at 8:18:26 AM (# 2)

try something like this.

select u_id
from tablewhatever as t
where (select count(u_id) from tablewhatever as t2 where t2.u_firstname=t.u_firstname)=1

If you're using something like MySql or MS Access then this may not work but it should be fine with Sql Server, Oracle or any other real database :)

You may also have to tweak it a little as the syntax might not be quite right.


bod1467 on Mar 15, 2007 at 12:36:13 AM (# 3)

Why might that not work with Mysql or Access? Looks like standard SQL syntax - nothing bespoke or platform-specific as far as I can see.


brian on Mar 15, 2007 at 5:28:06 AM (# 4)

It is...but in past experience I've found mysql (admittedly v4) to do strange things with what would be considered a standard sql statement (especially complex joins, unions and sub-queries). And MS access, well, it is good for what it is but again it does wierd things and anyone who is an experienced access programmer would probably tell you the same thing.


vahid_reza on Mar 15, 2007 at 2:04:27 PM (# 5)

it worked but too slow ! i used this sql syntax with Absolute Database that is a pascal file based database ! and i think it work with mySql too .

Thanx brian !


Earlier Replies | Replies 2 to 5 of 5 | Later Replies

To respond to a discussion, you must first logon.

If you are not registered, please register yourself to become a member of the SiteExperts.community.

User Name
Password
Copyright 1997-2004 InsideDHTML.com, LLC. All rights reserved.