Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 23rd, 2024, 3:22 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Database query without repeat names.
PostPosted: November 20th, 2007, 2:47 pm 
Offline

Joined: September 8th, 2007, 2:05 pm
Posts: 7
Hi, sorry for my english... I will try to explain my problem.

I am developing an application about soccer players. I want to display in a page a list about all the players, but the problem is that in the database the same name appair more than one time (the same player can play in 2 diferents teams the same season)

Anybody knows how to show this list, but without repeat the same name?

Thanks a lot.


Top
 Profile  
 
 Post subject:
PostPosted: November 20th, 2007, 3:15 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
This is normally a database design issue as the information that is unique such a player's name should be in a table of its own.

However, assuming your dataset is returning information that could be unique IE just the players name then depending on which DB you are using, you need the SQL command DISTINCT. If you are using Opus Actions instead of scripting this may not be possible but you could alway create a query in the database that returns the information and access this from Opus instead of the table.

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject:
PostPosted: November 20th, 2007, 4:03 pm 
Offline

Joined: April 11th, 2005, 2:31 pm
Posts: 122
Location: Edinburgh
Hi,

As Mack says this is down to the design of your database, which needs to be normalized ;

Each field should contain the smallest meaningful value.
There should be no repeated groups of fields (similar data belongs in the same field).
There should be no unnecessarily repeated data values.
Where practical, all fields in a table should be relevant to every record.

Do a web search - there are plenty of sites which cover this.

The only way I can think of to eliminate duplicates is to store each player's name in an array and check the array before adding another name - but, if you have large amounts of data this will become very slow.

_________________
Windows 7 Ultimate (32 bit)
Opus Pro 6.4, Opus 7
Dual Core Athlon 64 4000+
4 gb Ram


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 49 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group