Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2009-07-13
2
Medium Priority
?
1,816 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 500 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 500 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
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…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

660 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