I believe you have discovered a bug. "select basketfile1_.ID" is correct, but "basketfile1_.FundID = basketfile1_.FundID" is not. Try different things, like switching x and z in the Any predicate, or
var currentPortfolios = portfolios.Query().Where(x => baskets.Query().Any(z => z.EffectiveDate == Clock.Yesterday && x.FundID == z.FundID)); /G 2011/5/18 Bobby Johnson <[email protected]> > I have the following queries in my system: > > var currentBaskets = baskets.Query().Where(x => x.EffectiveDate == > Clock.Yesterday);var currentPortfolios = portfolios.Query().Where(x => > currentBaskets.Any(z => x.FundID == z.FundID)); > > > When executed it generates the following sql: > > select portfolio0_.Portfolio as Portfolio4_, > portfolio0_.StateStreetFundID as StateStr2_4_, > portfolio0_.PortfolioType as Portfoli3_4_, > portfolio0_.PortfolioManager as Portfoli4_4_, > portfolio0_.Description as Descript5_4_, > portfolio0_.BaseCurrency as BaseCurr6_4_ > from [Setup].[t_Portfolios] portfolio0_ > where exists (select basketfile1_.ID > from [PublishData].t_BasketFiles basketfile1_ > where basketfile1_.EffectiveDate = '2011-05-17T00:00:00.00' > /* @p0 */ > and basketfile1_.FundID = basketfile1_.FundID) > > I expected to get a query that looked like this: > > select portfolio0_.Portfolio as Portfolio4_, > portfolio0_.StateStreetFundID as StateStr2_4_, > portfolio0_.PortfolioType as Portfoli3_4_, > portfolio0_.PortfolioManager as Portfoli4_4_, > portfolio0_.Description as Descript5_4_, > portfolio0_.BaseCurrency as BaseCurr6_4_ > from [Setup].[t_Portfolios] portfolio0_ > where exists (select basketfile1_.FundID > from [PublishData].t_BasketFiles basketfile1_ > where basketfile1_.EffectiveDate = '2011-05-17T00:00:00.00' > /* @p0 */ > and basketfile1_.FundID = > portfolio0_.StateStreetFundID) > > Note that the exists filters on the otter query's FundID. > > Am I forming this query correctly or have I discovered a bug? > > Bobby > > -- > "The explanation requiring the fewest assumptions is most likely to be > correct." > > - Occam’s Razor > http://en.wikipedia.org/wiki/Occam's_Razor > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
