Jump to content


How to select unique data

  • Please log in to reply
2 replies to this topic

#1 nysebamse

  • Members
  • PipPip
  • Member
  • 16 posts
  • LocationBergen, Norway

Posted 23 September 2003 - 08:49 AM

Id like a query that only selects unique data, that is if the data exists in more than one row it will only select the first instance.

Is this possible?

Im planning to use this in a table that holds ip-adresses.
Go get Firefox![br][br]http://www.mozilla.org/

#2 shivabharat

  • Members
  • PipPipPip
  • Advanced Member
  • 371 posts
  • LocationChennai, India

Posted 23 September 2003 - 09:10 AM

Try this

select distinct * from table_name;

You can also refer the manual for more info.
Knowledge --- Reading Enriches Mind But Sharing Enhances It.[br][br]Note: Before you request help enusre that you have had a look at the tutorials @phpfreaks

#3 Fyorl

  • Members
  • PipPipPip
  • Advanced Member
  • 273 posts
  • LocationUK

Posted 23 September 2003 - 05:33 PM

I dunno but wouldn\'t:

SELECT ip_address FROM table_name WHERE unique_column=\'$unique_user-inputted_variable\'

work? Hmm. Actually, I suppose it would only work if you were using a membership system and each person had their own id or something and they typed it in and it came up with their ip address.

Don't worry, the printer fairies will sort it out.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users