Accessing a list in SQL
I have a list of certain data (basically a number) that is separated by commas.
If I wanted to make conditions in my query to the database, what is the best way?
WHERE attribute_values = #form.searchsize#
The #form.searchsize# (if your curious to what kind of variable, it is coldfusion) is a variable passed on through a form. I basically need the field attribute_values to be searched in a each record. Each attribute_values contains several size numbers. IE - 1,2,3,4,5,.... How would I be able to question the database if #form.searchsize# is one of these numbers in the list?
Try the find_in_set() function. If it returns >0, then it's in the list.
Something like this?
I tried this and could not get it to work.
Basically I need to know if the #form.searchsize# variable is within the data (separated by commas, therefore commas are the delimiter) in each table within the attribute_values field.
attribute_values (MS Access Field)
I need to check each row's attribute values and see if my #form.searchsize# variable is in it's list.
Last edited by bradleybebad; 06-12-2009 at 01:46 PM.
Sorry, I guess find_in_set is just a mysql thing. I don't know Access, but I'd assume there's some sort of string search function.
Maybe using IN would work:
WHERE #form.searchsize# IN (attribute_values)
anyone have any clue on how to do this in MSSQL?
Is there a "IN" in MSSQL? For example:
Select ..... Where attribute_values IN #form.searchsize#
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)