【发布时间】:2011-02-10 10:16:39
【问题描述】:
我想这样查询:
select * from table where concat(',', ServiceCodes, ',') like '%,33,%';
select * from table where (','||ServiceCodes||',') like '%,33,%';
所以,我写了这段代码:
ICriteria cri = NHibernateSessionReader.CreateCriteria(typeof(ConfigTemplateList));
cri.Add(Restrictions.Like(Projections.SqlFunction("concat", NHibernateUtil.String, Projections.Property("ServiceCodes")), "%,33,%"));
我得到类似的sql:
select * from table where (ServiceCodes) like '%,33,%';
但这不是我想要的,怎么办??? 谢谢!
【问题讨论】:
标签: sql nhibernate