I have a LINQ query that is generating an additional / duplicate INNER JOIN for some reason. This is causing the reason for not returning the expected output to the query if I comment additional joints from the manually generated SQL, then I get the proper output.
Can you figure out what I could have done in this LINQ due to this extra couple?
Thank you.
Here's my almost LINQ
predicate = predicate.And (condition1); Predicate1 = predicate1.And (CONDITION2); Predicate1 = predicate1.And (condition3); Predicate2 = predicate2.Or (predicate1); Predicate = predicate.And (predicate2); Var ids = reference.code.here (diagnosis); R RS = R.R. in R In the Rd R = Rpis IDI in the ID R group by PSCNID, G.City = G. Select (P => P. Phoenix.phoneNew) .Desting (). Calculate () where Macchout == 2 select new {personid = G. Of}; and the SQL generated here (is included in the duplicate [t7])
Announce @P1 VarChar (10) = declare 'Home' @ P4 VarChar (10) = '111' Announced @ P3 VarChar (10) = Declare 'Office' @ P4 VarChar (10) = '222' declared @ P5 int = 2 SELECT [T9]. [PersonID] as [pid] FROM ([Personality], (Select number (*) (Selection Number [t7]. [Phone Value] [DBO]. [Person] AS [T4] Inner Join [DBO ] [PersonNumber] on AS [T5] [T5]. [PersonID] = [T4]. [PersonID] Inner Join [DBO]. [Codemaster] AS [T6] On [T6]. [Code ] [Persona] = [T5]. [Phone Type] Inner Join [DBO] as [PersonPhoneNumber] [t7] ON [t7]. [PersonID] = [T4]. [PersonID] where ([T3]. [ PersonID] = [T4]. [PersonID] and [[T6]. [([[T6]] and [[code disacusion] = @ P1] and ([T5]. [Phone value] = @ P2) or (( [T6]. [Code Description] = @ P3) and ([T5]. [Phone Value] = @ P4))) [T8]) from AS [Value] (Selection [T]]. [Person [person]] [DBO]. [Person] AS [T] Inner Join [DBO]. [PersonaFonumber] AS [T1] On [T1]. [Personia] = [T.]. [Personia] Inner Join [DBO]. [T2] at [T2]. [Code] = [T1]. [Phone Type] WHERE ([T2]. [Enumeration] = @ P) AND ([[T2]. [CodeDescription] = @ P1) and ([T1]. [Phone Value] = @ P2) or (([T2]. [CodeDescription] = @ P3) and ([T1 ]. [Phone value] = @ P4))) by group [t] [[T3] AS [T3] AS [T9] WHEEE [T9]. [Value] = @ P5They are not being duplicated as you are using data sources Asking for two different values.
Let's matchcount = g.Select (p = & gt; p.phonenumbers.PhoneNum). Undoubtedly (). Due to calculation ()<< Pre>Select
from COUNT (*) (select [t7]. [Phone value] [dbo] [Person] AS [T4] Inner Join [DBO]. [PersonaFonumber] AS [T5] On [T5]. [Personia] = [T4]. [Personia] Inner Join [DBO]. [Code Master ] [T6] On [T6]. [Code] = [T5]. [Phone Type] Inner Join [DBO]. [Personphone Number] AS [T7] On [T7]. [Personia] = [T 4]. [Persona] Where [[T3]. [Personnad] = [T4]. [PersonID]) and ([T6]. [Enumeration] = @ P) and ((([T6] [ ([[T-6] [CodeDescription] = @ P3) and ([T5]. [Phone Value]] [Phone Value] = [P1] and ([T5]. [Phone Value] = @ P2) = @ P4))) AS [T8]and
R. R. PSCIDID group R. G.[Person] AS [T] Inner Join [DBO]. [PersonaFonnumber] AS [T1] On [T] 1]. [Code] [code2]. [Code] = [T1]. [Phone type] WHERE ([t2]. [Enumeration] = @ p0) and (((([[ T2]] [coded Pson] = @ p1) and ([T1]. [Phone value] = @ P2) or ([[T2]]. [Code dipson] = @ P3) and [[T1] [phone value] = @ P4)) Group [T.] [Personia]] AS [T3]For Inner Johns, the reason you are getting the relationship between those tables is for example PersonPhoneNumber (or 1 .. *) 1..1. In either case I have PersonK value on PersonPhoneNumber, an FK and PK value. So in that case the data source should go to the external table whether the value of the PersonPhoneNumber navigation property actually exists. It performs by doing an inner joining on that table.
Comments
Post a Comment