使用Linq to SQL,我想首先合并这两个字段:DateEnter
(Date?
类型)和TimeEnter
(Integer?
类型)。按降序模式对它们进行排序。将合并的DateEnter
和TimeEnter
合并到select的一个字段中。
我一直不支持翻译sql的方法。
Dim query = From a In dataContext.Orders
Join b In dataContext.OrderStatus On b.OrderName Equals a.Name
Where b.Status = "Finished"
Let UpdatedAt = b.DateEnter + TimeSpan.FromHours(b.TimeEnter)
Order By UpdatedAt Descending
Select New With {
Key .LastUpdatedAt = UpdatedAt,
Key .Name = a.Name,
Key .Owner = a.OrderOwner}
答案 0 :(得分:0)
Dim query = From a In dataContext.Orders
Join b In dataContext.OrderStatus On b.OrderName Equals a.Name
Where b.Status = "Finished"
Order By b.DateEnter.Value.AddSeconds(b.TimeEnter) Descending
Select New With {
Key .LastUpdatedAt = b.DateEnter.Value.AddSeconds(b.TimeEnter)
Key .Name = a.Name,
Key .Owner = a.OrderOwner}
能够得到它。