1
我有以下的自定義SQL查詢與OrmLite:參數化一個ServiceStack自定義的SQL查詢
var results = db.Select<Tuple<Customer,Purchase>>(@"SELECT c.*, 0 EOT, p1.*
FROM customer c
JOIN purchase p1 ON (c.id = p1.customer_id)
LEFT OUTER JOIN purchase p2 ON (c.id = p2.customer_id AND
(p1.date < p2.date OR p1.date = p2.date AND p1.id < p2.id))
WHERE p2.id IS NULL;");
什麼是添加一個可選的WHERE子句,例如過濾給定的客戶名稱字段的最佳途徑時,字段有價值或爲查詢添加分頁?
http://stackoverflow.com/a/37847762/193634 –
@RosdiKasim如何使WHERE子句可選? – kolrie