var innerEx = from b in Query.All<RegBalance>()
join p in Query.All<RegCalculatedPrice>() on new { b.FinTool, b.AuthDate } equals
new { p.FinTool, AuthDate = (DateTime?)p.ActualizationDate }
where b.ActualVolume > 0
select
new AnonymousClass
{
FinTool = b.FinTool,
AuthDate = b.AuthDate,
Fund = b.Fund,
ActualVolume = (decimal?)b.ActualVolume,
VolumeDelta = (decimal?)b.VolumeDelta,
Price = (decimal?)null
};
var balEx = from b in Query.All<RegBalance>()
select
new AnonymousClass
{
FinTool = b.FinTool,
AuthDate = b.AuthDate,
Fund = b.Fund,
ActualVolume = (decimal?)b.ActualVolume,
VolumeDelta = (decimal?)b.VolumeDelta,
Price = (decimal?)null
};
var unionPrice = from p in Query.All<RegCalculatedPrice>()
select
new AnonymousClass
{
FinTool = p.FinTool,
AuthDate = (DateTime?)p.ActualizationDate,
Fund = (Fund)null,
ActualVolume = (decimal?)null,
VolumeDelta = (decimal?)null,
Price = (decimal?)p.Price
};
var unionRes = balEx.Except(innerEx).Union(unionPrice)
.OrderBy(a => a.FinTool).ThenBy(a => a.AuthDate).ThenBy(a => a.Fund);
I've got translation exception, it cannot union those results, why??
Updated at 09.08.2010 8:26:19
hm... why? Peoply usually union different table results
This thread was imported from our support forum. The original discussion may contain more detailed answer.
asked
Aug 05 '10 at 07:57
xumix
425●75●76●82
You can, but item types there (i.e. value of type parameter T in IQueryable<t>) must be identical.
Some new comment goes here for testing purposes. There are some edits happens.