2009/8/20 ZB <z...@ispid.com.pl>:
> I need to search a table, which has - say - about 20 columns. Each column
> should be checked against given string ("phrase"), in usual manner:
>
>  SELECT something FROM table WHERE col1 LIKE '%phrase%' OR col2 LIKE
>  '%phrase%' OR col3 LIKE '%phrase%' ... OR col20 LIKE '%phrase%'
>
> I'm afraid, it will be inefficient. Perhaps better would be to concat all
> the fields together, and search for first occurence of "phrase" only that
> big string? Does there exist any possibility to make it such way?
>
> Or perhaps there's other, better solution?
>                                pozdrawiam / regards
>                                                Zbigniew

SELECT something FROM table WHERE (col1||';'||col2||...||col20) LIKE '%phrase%'
-- 
Kit
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to