Solved

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

Posted on 2009-07-13
2
1,799 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
2 Comments
 
LVL 59

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PHPStorm debugging issues 1 25
Mysql sync between 3-4 mysql db 4 25
Amazon Redshift 2 28
Preventing users manipulating URL strings 10 37
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…
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

863 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now