February 4, 2010 at 2:17 pm
Hello all,
I'm stumped and I don't know if what i'm trying to do is really even possible.
Essentially, I have an online catalog of products. These products have attributes associated with them. These attributes are organized into categories. The number of categories and attributes is dynamic, meaning the admin of the store can create new categories and associated attributes for that category.
I've created a product filter that pulls in the categories and attributes. It uses a repeater to display the categories with a sub repeater to display each attribute within that category along with a check box. The idea being the user can check all the attributes they would like and filter the products based upon it.
The code retrieves a list of all the attributes and i'm attempting to write a query that will essentially return the correct products. The problem I'm having is that I can't just say give me all the products that are "IN" the list of attributes because the attributes are not all within the same category.
Example
If I want a car with color being red or blue and the type being a truck or a an suv.
I would be passing in the attributes for red, blue, truck, suv and I need to find vehicles with either color AND either type...
Can anyone assist?
February 4, 2010 at 4:53 pm
Please provide table def, sample data, expected result and what you've tried so far as described in the first link in my signature.
It's much easier to demonstrate what you're trying to do by showing a few lines of code rather than a dozen lines of verbal description.
February 5, 2010 at 8:15 am
This really isn't a SQL problem per se, but more of a .NET/UI issue. You have some options, but they all really involve building your parameter values in the UI. Are you building the SQL dynamically in the application or are you calling a stored procedure? How I'd do it will vary based on how you are calling the SQL?
Are you really using SQL Server 2008? That can change how you do it as well.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply