Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

selecting only 1 of several duplicate records
say i have a statement as such :

select Name, ID from Staff where Status=1


However staff table contains duplicate entries of every record.
Is there a shortcut such that i only retrieve one of each duplicate
record, but all the unique records are retrieved

i.e there is more than 1 unique record where Status =1

i.e

ID   Name   Status
01   John     1
01   John     1
03   Tom     1
03   Tom     1
05   Sam     1
05   Sam     1
07   Chris    0
07   Chris    0

i want to retrieve one entry of each unique name



----------------------------------------
The post originated from PHP Freaks:
----------------------------------------
http://www.phpfreaks.com
http://www.phpfreaks.com/forums



Report this thread to moderator Post Follow-up to this message
Old Post
fozie
08-18-04 08:57 PM


Re: selecting only 1 of several duplicate records
I don,t think you can etrive only one, but you can SHOW only one:

1 - Sort them by ID in your query

2 - Declare id1="" before your loop

3-
id2=myresult['id'];

while (id1 != id2){

===yourscript here===

id1=id2
}

should work...



----------------------------------------
The post originated from PHP Freaks:
----------------------------------------
http://www.phpfreaks.com
http://www.phpfreaks.com/forums



Report this thread to moderator Post Follow-up to this message
Old Post
tox_yray
08-18-04 08:57 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP SQL archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:43 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.