How do I perform an 'IN' query against delimited string?

How do I perform an 'IN' query against delimited string?

drettbergdrettberg Posts: 6Questions: 3Answers: 1

I am trying to get all records that have DisplayLocation_IDs within a delimited string (e.g. "1,6,12").

I have tried the following but I get "Incorrect syntax near '1'".

.Where( q => q.Where("DisplayLocation_ID", locIds, "in", false))

Any help is appreciated

Answers

  • allanallan Posts: 63,871Questions: 1Answers: 10,522 Site admin

    Try:

    "(1,6,12)"
    

    The would then look like:

    DisplayLocation_ID IN ( 1,6,12 )
    

    in the SQL.

    Allan

  • drettbergdrettberg Posts: 6Questions: 3Answers: 1

    Thanks Allan. Did the trick

This discussion has been closed.