What's the best way of using coalesce keyword in Subsonic 2.2 query?
-
21-06-2021 - |
Question
I want to create the following query using Subsonic 2.2:
SELECT coalesce(col1, col2) AS result
FROM someTable
Solution
Something similar to this:
DAL.DB.Select(
string.Format("COALESCE({0}, {2}) as result",
DAL.SomeTable.Columns.col1,
DAL.SomeTable.Columns.col2
))
.From<DAL.SomeTable>()
...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow