Move specific column value to first row first

112 Views Asked by At

I need to move the Status == 'Processing' to the first row at here. I tried used OrderBy but return SqlExpression error as there is OrderByFields before it. Can anyone help?

var inputQuery = db.From<WO>()
                      .Where<WO>(x => x.ProcessDateTime.Substring(5, 2) == "06")
                      .OrderByFields("PRDLine", "-ProcessDateTime");
1

There are 1 best solutions below

0
labilbe On

You must pass SqlExpression to Single method.

var result = db.Single(inputQuery);

If you only want first row, add .Take(1) after OrderByFields so you force SELECT TOP 1 on SQL query generation.