我正在使用Subsonic3,希望在两个表之间得到一个左外接。下面是经过测试的SQL
SELECT a.*
FROM vwVendor a
LEFT OUTER JOIN dbo.pubvenmap b
on a.vend_no = b.vend_no
where b.vend_no is null我被困在
Dim vendors = From v In vwVendor.All()
Join m in pubvenmap.All() On v.vend_no Equals m.vend_no更新了--我还尝试了以下方法
Dim vendors = New SubSonic.Query.Select(SubSonic.Query.Aggregate.GroupBy("vend_no")).From(Of vwVendor).LeftOuterJoin(Of mac_pubvenmap)().ExecuteTypedList(Of vwVendor)()但是得到错误
System.InvalidOperationException类型的第一次例外发生在SubSonic.Core.dll中
我正在使用Visual 2010和.NET 4.0...could,这是问题吗?
发布于 2011-03-25 21:18:00
如果LINQ表达式Albin给您带来麻烦(亚音速的LINQ提供程序不如Linq2Sql或实体框架的那样完整),请注意,您可以使用亚音速的fluent查询对象执行左外接:
SubSonic.SqlQuery query = new NorthwindDB.Select
.From<Customer>()
.LeftOuterJoin<Order>();
query.Aggregates = new List<Aggregate> {
new Aggregate(CustomerTable.CustomerNameColumn, AggregateFunction.GroupBy) };发布于 2011-03-25 20:25:32
所有常见的LINQ结构都以LINQ 101样品为例。特别是在本例中,左外连接。
如果我把我生疏的VB做对了,你的代码就会是这样的。
Dim vendors = From v In vwVendor.All() _
Group Join m in pubvenmap.All() On v.vend_no Equals m.vend_no Into Group _
From m In Group.DefaultIfEmpty() _
Select vhttps://stackoverflow.com/questions/5437615
复制相似问题