Rev cgi & mySQL (again)

Dave Cragg dave.cragg at lacscentre.co.uk
Fri Jan 2 21:03:21 EST 2009


On 2 Jan 2009, at 20:38, jbv wrote:
> So the query is quite straightforward, for instance :
> SELECT Col1, Col2, Col3, Col4 FROM myTable WHERE Col1 = "toto" OR
> Col2 = "toto" OR Col1 = "tata" OR Col2 = "tata" OR Col1 = "titi" OR  
> Col2 = "titi"...
> up to possibly 50 elements.

I think all those OR conditions will cause a slowdown. Another  
approach might be to use UNION and IN. (Warning: I've never done a  
query of this kind.)

(
SELECT  Col1, Col2, Col3, Col4
    FROM myTable
	WHERE Col1 IN ('toto,tiki,tata,etc.')
)
UNION DISTINCT
(
SELECT  Col1, Col2, Col3, Col4
    FROM myTable
	WHERE Col2 IN ('toto,tiki,tata,etc.')
)

Good luck!

Cheers
Dave



More information about the use-livecode mailing list