Filed Under: General

SQL: Select table entries with the same value

29 March 2008 No Comment Tags: , ,

Let’s say you got a table with lots of entries that have the same value and you want to safe each entry in an array even if it’s a “duplicate”, you can do it with a simple SQL query:

 

$query = $db->query("SELECT * FROM $db->tablename where exists ( SELECT tablerow_name FROM $db->tablename) ") ;

 

I hope that helps a bit :)







Like our posts? Then subscribe via Mail:

Email:  

Similar Posts:

Socialize:

delicious stumbleupon

Leave your response!

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="">

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.com.