Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1823
  • Last Modified:

PHP MySQL Select *, repeat all, but no duplicates...

Hi,  

What code do i need to add so that...
when i perform a query from a MySQL database and run them through a repeat all...
it will not display duplicates..

e.g.
Every Record i am querying on has a year value. i.e. 2008,2009 etc
Several Records may have the same year value i.e. 2008,2008,2009,2009

I want to not display the year multiple times, only once?

Thanks!


0
dev09
Asked:
dev09
2 Solutions
 
Kevin CrossChief Technology OfficerCommented:
What you can do is to SELECT DISTINCT to get your listing of years in data?  Something like this:
SELECT DISTINCT year FROM your_table;

Open in new window

0
 
ajkhalifaCommented:
using DISTINCT keyword after SELECT
SELECT DISTINCT [column] FROM [table_name]
if the table is too large then running DISTINCT is a big deal... there are advance solutions...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now