How do I use the SQL WHERE IN construct with PetaPoco?

前端 未结 5 1138
鱼传尺愫
鱼传尺愫 2020-12-24 13:20

I have a database table named Tags (Id, Name) from which I would like to select the ones where the name matches a name in a list. In SQL I would use something like:

5条回答
  •  执笔经年
    2020-12-24 13:48

    Posting this for future seekers. This works.

        public IEnumerable GetInvoicesByStatus(List statuses)
        {
            return _database.Fetch(@"
                select *
                from Invoices                   
                where Status IN (@statuses)",
                new { statuses });
        }
    

提交回复
热议问题