Re: [sqlite] Parenthetical LIKE query ??

2009-01-04 Thread P Kishor
On 1/4/09, Ben Marchbanks  wrote:
> SELECT * FROM `pagesText` WHERE  pageText LIKE ( "%muffler%" , "%clamp%" )
>
>  Is there a nice way to write a query using parenthetical LIKE ?

afaik, there is no option for using LIKE in the manner of IN (as you
are trying to do above). You can match for each pattern separately
using OR between each clause.

Also, use double quotes to quote the table or column names and single
quotes to delimit the pattern... so, you should use

SELECT * FROM "pagesText" WHERE pageText LIKE '%muffler%' OR pageText
LIKE '%clamp%';


>
>  Queries like this can get quite long otherwise
>
>  Any suggestions ?
>
>
>  *Ben Marchbanks*
>
>  www.magazooms.com 
>  Signature
>  Email: b...@magazooms.com 
>  Phone: (864) 284.9918
>  ___
>  sqlite-users mailing list
>  sqlite-users@sqlite.org
>  http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>


-- 
Puneet Kishor http://www.punkish.org/
Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Parenthetical LIKE query ??

2009-01-04 Thread Igor Tandetnik
"Ben Marchbanks"  wrote in
message news:49615144.7090...@alqemy.com
> SELECT * FROM `pagesText` WHERE  pageText LIKE ( "%muffler%" ,
> "%clamp%" )
>
> Is there a nice way to write a query using parenthetical LIKE ?

SELECT * FROM pagesText
WHERE pageText LIKE '%muffler%'  OR pageText LIKE '%clamp%';

If you have a long list of patterns you want to compare against, insert 
them all into a temp table then do something like this:

SELECT * FROM pagesText WHERE EXISTS (
select 1 from patterns where pageText LIKE '%' || pattern || '%');

Igor Tandetnik 



___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Parenthetical LIKE query ??

2009-01-04 Thread Ben Marchbanks
SELECT * FROM `pagesText` WHERE  pageText LIKE ( "%muffler%" , "%clamp%" )

Is there a nice way to write a query using parenthetical LIKE ?

Queries like this can get quite long otherwise

Any suggestions ?


*Ben Marchbanks*

www.magazooms.com 
Signature
Email: b...@magazooms.com 
Phone: (864) 284.9918
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users