coldfusion - SQL IN - Variable inside of table column? -
i know how check value of table column inside variable list, so:
<cfquery datasource="test_sql" name="get"> select b c in ( <cfqueryparam cfsqltype="cf_sql_varchar" list="true" value="#d#"> ) </cfquery>
but how reverse clause? i've tried hasn't worked:
<cfquery datasource="test_sql" name="get"> select b <cfqueryparam cfsqltype="cf_sql_varchar" value="#c#"> in (d) </cfquery>
this looks match within list stored in column d has value c.
eg.
c = 12345 column d - 4 rows 12344,12345,12346 --- match (list item 2) 12323,12327,12375 --- no match 12312,12341,12345 --- match (list item 3) 12128,12232,12345 --- match (list item 3)
the record count should 3 there total of 3 matches value present within list. however, when run query not work.
i'd assume many people have stumbled upon minor problem before , know solution. appreciated!
this query logic should work
where d = <cfqueryparam cfsqltype="cf_sql_varchar" value="#c#"> --- c element or d <cfqueryparam cfsqltype="cf_sql_varchar" value="#c#,%"> --- c first element or d <cfqueryparam cfsqltype="cf_sql_varchar" value="%,#c#,%"> --- c in middle somewere or d <cfqueryparam cfsqltype="cf_sql_varchar" value="%,#c#"> --- c last element
Comments
Post a Comment