G
Gyetko
I have a variable string of data I want to use with the In() function
in a query but I can't get it to work because the In sees it as one
long string rather than a comma delimited string.
Ex:
Table1 - Field1 - Row1 = A
Table1 - Field1 - Row2 = B
Table1 - Field1 - Row3 = C
my_variable = "A,C"
SELECT Table1.Field1
FROM Table1
WHERE Table1.Field1 In (my_variable)
This query should just return rows 1 & 3, but it's reading the
parameter as In ("A,C") instead of In ("A","C"). Does anyone know how
I can make this work?
I've tried my_variable = " 'A','C' ".
If this can be done, then I have one more question. What if the
variable is empty? In ()
in a query but I can't get it to work because the In sees it as one
long string rather than a comma delimited string.
Ex:
Table1 - Field1 - Row1 = A
Table1 - Field1 - Row2 = B
Table1 - Field1 - Row3 = C
my_variable = "A,C"
SELECT Table1.Field1
FROM Table1
WHERE Table1.Field1 In (my_variable)
This query should just return rows 1 & 3, but it's reading the
parameter as In ("A,C") instead of In ("A","C"). Does anyone know how
I can make this work?
I've tried my_variable = " 'A','C' ".
If this can be done, then I have one more question. What if the
variable is empty? In ()