List:General Discussion« Previous MessageNext Message »
From:Thimble Smith Date:March 2 2000 4:42pm
Subject:Re: Criteria on concatenated columns SQL question
View as plain text  
On Thu, Mar 02, 2000 at 07:27:54AM -0800, Harrell, Roger wrote:
>Is there any way to place criteria on concatenated columns? eg...
>
>select concat(fld1, fld2) as total where total="criteria" 

Use a HAVING clause.  It acts on the result set....

>My other option to do what I need isn't really good.
>
>Is there a way to do a select for a certain criteria over several fields
>without individually specifying each field? EG I want to search for abc in
>field 12, 34, and 56. I can do this by typing select (12, 34, 56) from table
>where 12 like '%abc%' or 34 like '%abc%' or 56 like '%abc%' 
>
>Is there a way to specify it something like select (12, 34, 56) from table
>where (12, 34, 56) like '%abc%'. So when I have large numbers of criteria
>and fields my SQL statement does not have to have 500 arguments.

The way to do this is to fix your database structure so that you
don't have to do this.  :|

Tim
-- 
Tim Smith   < tim@stripped >  :MySQL Development Team:  Boone, NC  USA.
Thread
Criteria on concatenated columns SQL questionRoger Harrell2 Mar
  • Re: Criteria on concatenated columns SQL questionThimble Smith2 Mar