[thelist] SQL (or ASP?) selecting from a multi-valued column

Erik Mattheis gozz at gozz.com
Tue Feb 6 01:27:37 CST 2001


Seems this would require CommaSeparatedList to be a subquery:

>"select * from display where [cat] in (" & CommaSeparatedList & ") 
>order by [name]"
>lane

Maybe someone translate this to ASP:

<cfset strLen = Len(cat) + 1>
<cfquery datasource="dsn" name="solution">
	SELECT *
	FROM display
	WHERE cat LIKE '%,#cat#,%' OR
		LEFT(cat,#strLen#) = '#cat#,' OR
		RIGHT(cat,#strLen#) = ',#cat#'
</cfquery>


>  > From: "Elfur Logadottir" <elfur at elfur.is>
>>  Date: 2001/02/05 Mon PM 10:19:50 EST
>>  To: <thelist at lists.evolt.org>
>  > Subject: [thelist] SQL (or ASP?) selecting from a multi-valued column
>>

<paraphrased>
What's the SQL to return columns which contain a comma delimited list 
of values if that list contains a particular value that I want to 
pass to the SQL statement?
</paraphrased>

>  > thanks
>>  [elfur]
>  > *the frustrated one*
-- 
- Erik Mattheis
http://gozz.com/
(612) 827 3963




More information about the thelist mailing list