locked
faster query search based on multiple AND search criteria RRS feed

  • Question

  • User-153404742 posted

    Hi,

    Just a general question on what the best query approach would be to do a fast search based on multiple AND search criteria on the same table.  So I will be joining two tables on ID and the records obtained on the 2nd table has a label attached to each of the User IDs.  There will be a search page where user can enter up to 10 search criteria selecting the following for each of the 10 items:

    Label name, start and end date

    So I want to return all records where the labels are exactly what they enter and fall between start and end date....if user selects another one with an AND, user needs to have the 2nd label with start and end dates that fall between the selected start and end dates....and another AND the similar way.  There could be an OR option or AND option.  What's the fastest way to write a sql query, or LINQ to handle this?

    Table will have:

    UserId, Label, StartDate, EndDate

    Tuesday, November 5, 2019 5:34 PM

All replies