|
Posted by Adam Englander on 07/09/07 04:46
DR wrote:
> Is it possible to search within concatenated fields in mySQL?
>
> This query works fine:
>
> SELECT CONCAT(title, description) AS searchInMe FROM content
>
> But when I try searching within 'searchInMe' I get an unknown column
> error. This is the (Dreamweaver generated) query:
>
> $query_search = sprintf("SELECT CONCAT(title, description) AS
> searchInMe FROM content WHERE searchInMe LIKE '%%%s%%'",
> $searchTerm_search);
>
> Is it that I cannot search within concatenated fields?
>
> Many thanks,
>
> Dmitri
>
If you can do it, us an OR statement instead of searching in a
concatenated string. It will likely use a lot fewer resources on the
database.
Adam
Navigation:
[Reply to this message]
|