0

I want to create the following query using Subsonic 2.2:

SELECT coalesce(col1, col2) AS result
FROM someTable
marapet
  • 54,856
  • 12
  • 170
  • 184
Stewart Alan
  • 1,521
  • 5
  • 23
  • 45

1 Answers1

1

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>()
...
marapet
  • 54,856
  • 12
  • 170
  • 184
  • Yeah, that's what I ended up going with. Was just wondering if there was any way of doing it using actual Subsonic properties – Stewart Alan Jul 17 '12 at 11:10
  • Unfortunately no - sometimes using views can be a workaround, otherwise you'd have to implement it yourself in SubSonic. – marapet Jul 17 '12 at 11:30