I am using Subsonic3 and would like to get a Left Outer Join between two tables. Here is the tested 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
I am stuck at
Dim vendors = From v In vwVendor.All()
Join m in pubvenmap.All() On v.vend_no Equals m.vend_no
UPDATED I also tried the following
Dim vendors = New SubSonic.Query.Select(SubSonic.Query.Aggregate.GroupBy("vend_no")).From(Of vwVendor).LeftOuterJoin(Of mac_pubvenmap)().ExecuteTypedList(Of vwVendor)()
but get the error
A first chance exception of type 'System.InvalidOperationException' occurred in SubSonic.Core.dll
I am using Visual Studio 2010 and .NET 4.0...could this be the problem?
If the LINQ expression Albin posted gives you trouble (SubSonic's LINQ provider is not as complete as Linq2Sql or Entity Framework's), be aware that you can use SubSonic's fluent query objects to also perform a Left Outer Join:
SubSonic.SqlQuery query = new NorthwindDB.Select
.From<Customer>()
.LeftOuterJoin<Order>();
query.Aggregates = new List<Aggregate> {
new Aggregate(CustomerTable.CustomerNameColumn, AggregateFunction.GroupBy) };