approach to concat SQL string?
Tiemo Hollmann TB
toolbook at kestner.de
Thu Dec 2 04:41:10 EST 2010
Hi,
I need a very basic SQL SELECT with 1 up to 7 fields (f1-f7) to be selected,
like (reduced form):
SELECT * FROM myTable WHERE
f1=s1
AND f2=s2
AND f3=s3
...
AND f7=s7
The user can use only one field or any combination of up to 7 fields for
selecting.
>From coding point of view the easiest solution would be just one SQL
statement including all 7 fields and filling all not used parameters with
"%". But this is not very performant. So I should have only those fields in
my SQL string, which are actually used (depending on the user selection). To
do this I have to check in 7 "if-clauses" what is selected and depending on
that concat my resulting SQL string with only those fields needed.
Is this the old fashioned standard approach, or am I not seeing a more
sophisticated way with less coding?
Thanks
Tiemo
More information about the use-livecode
mailing list