Solved

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

Posted on 2009-07-13
2
1,808 Views
Last Modified: 2013-11-10
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
Comment
Question by:dev09
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 60

Accepted Solution

by:
Kevin Cross earned 125 total points
ID: 24839382
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
 
LVL 7

Assisted Solution

by:ajkhalifa
ajkhalifa earned 125 total points
ID: 24842364
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

Featured Post

Get Database Help Now w/ Support & Database Audit

Keeping your database environment tuned, optimized and high-performance is key to achieving business goals. If your database goes down, so does your business. Percona experts have a long history of helping enterprises ensure their databases are running smoothly.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question