Applying Multipal filters for item selection.

  • I have 2 tables Phone and Rules.

    I store a list of phones(information) in the Phone table and On the UI (UserInterface)

    I have a scree where user can create Rules using a bunch of drop down filters

    which they can select to create a Rule.

    The Filters on the UI are on PhoneName, Color, Mode l,and ScreenWidth.

    User can create rules by selecting these fileters and the values they select from dropdown goes to the Rules table

    2 such rules are in the below table the first one is to get all iphone 4S and the second one is to get all phone which are white in color.

    I need a SELECT statement that I can use to get all records on the phone table which match Rule1 or Rule2 in the Rules table.

    Phone

    NameColorModelScreenWidth

    iPhoneWhite4S4

    iPhoneBlack4S4

    iPhoneGold5S4

    iPhoneSilver5S4

    SamsungWhiteS55

    SamsungBlackS55

    HTCWhileOne4

    Rules

    RuleNameManufactureerFilterColorFilterModelFilterScreenWidthFilter

    Rule1iPhoneNULL4SNULL

    Rule2NULLWhiteNULLNULL

  • How about if you turn this into consumable ddl and data? Then show us what you have tried. It is not totally clear what you expect for output here either.

    Please take a few minutes and read the first article in my signature for best practices when posting questions.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply