Jaime,
You should be using the DISTINCT function.
SELECT DISTINCT account, id, FROM.... etc.

This should give you one instant of 'account' in your SELECT output.



At 09:24 AM 2/5/03 +0000, Jaime Teng wrote:
I have a MySQL table:

+------------+------------------+------+-----+---------+----------------+
| Field      | Type             | Null | Key | Default | Extra          |
+------------+------------------+------+-----+---------+----------------+
| id         | int(10) unsigned |      | PRI | NULL    | auto_increment |
| account    | varchar(10)      |      | MUL |         |                |
| detail     | text             | YES  |     | NULL    |                |
+------------+------------------+------+-----+---------+----------------+


I would like to perform a search,

SELECT id,account FROM tablename WHERE detail LIKE '%pattern%';

However, this would produce several hits for a single account.
I'd like it to produce only one hit *per* account and give me
id where '%pattern%' was found and account where it was found on.
It should only return *one* result per account.

regards,
Jaime



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php  (the manual)
   http://lists.mysql.com/          (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


---------------------------------------------------------------------
Before posting, please check:
  http://www.mysql.com/manual.php   (the manual)
  http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to