List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:February 6 2003 10:43pm
Subject:Re: need help with GROUP BY
View as plain text  
At 9:24 -0600 2/5/03, 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.


Either I am not understanding what you are saying, or what you are
saying makes no sense: If there are two id values for a given account
that have detail values matching the pattern, which id do you want
it to display?


sql, query
need help with GROUP BYJaime Teng5 Feb
  • Re: need help with GROUP BYFrank Peavy5 Feb
  • Re: need help with GROUP BYPaul DuBois6 Feb
RE: need help with GROUP BYTab Alleman5 Feb
Re: need help with GROUP BYFrank Peavy6 Feb
RE: need help with GROUP BYDavid Shapiro6 Feb