[英]How to simulate the MySQL bit_count function in Sybase SQL Anywhere?
[英]How can I use the MYSQL BIT_COUNT function through nhibernate/fluent nHibernate?
我正在做一些巫毒教,並且需要使用c#/ linq / fluent-nhibernate由bit_count運算符對結果進行排序。
這是我當前的訂單對帳單:
orderby m.InitiatorInventory & wanted descending
我真正想要的是這樣的東西
orderby BIT_COUNT(m.InitiatorInventory & wanted descending)
這是Mysql函數:
http://dev.mysql.com/doc/refman/5.0/zh-CN/bit-functions.html#function_bit-count
您可以使用CreateSQLQuery
,也可以在NHibernate中注冊自己的BIT_COUNT
方言:
public class MyDialect : MySqlDialect
{
public MyDialect()
{
RegisterFunction("bit_count", new StandardSQLFunction("bit_count", null));
}
}
更多信息在這里 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.