/    Sign up×
Community /Pin to ProfileBookmark

Removing Duplicate Items From A Database Search

I need to create a list of links that will be generated from a database search where users have entered in their types of business. Of course some users will have identical businesses and I only want the list to display one of each – no duplicates. So let’s say there’s 5 people and two are plumbers, I want the display list to only show one value of plumber.

I was going to have the database structured like this:

id | customer name | type of business|

The type of business will be numerical, generated from a list that will be on a drop down form that they will fill out. 1 = painter, 2 = plumber, 3 = electrician, etc…

So for this loop, how do I make it so it will only display the trade once and not three or four or a dozen times?? I just want to show that out of this group of people, this trade is at least one of their businesses.

Thanks in advance ?

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@NogDogMay 30.2009 — <i>
</i>SELECT [color=red]DISTINCT[/color] type_of_business FROM table_name
Copy linkTweet thisAlerts:
@NtrimgsauthorMay 30.2009 — Thanks Alot! You helped me immensely. Very appreciated!
×

Success!

Help @Ntrimgs spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...