Guest User

Guest User

  • Tech Writer
  • 611
  • 82.6k

Get Record From Two table .

Sep 30 2020 4:45 AM
How to get record from two table using linq c# .It's my code i have use this but i have face problem Get record but showing in multiple time entries.
  1. var Result = (from THiting in _context.TblHittingStatsDetail  
  2. join UM in _context.UserMaster on THiting.UserId equals UM.UserId  
  3. join TPitching in _context.TblPitchingStatsDetails on UM.UserId equals TPitching.UserId  
  4. where THiting.UserId ==Id && TPitching.UserId == Id  
  5. select new  
  6. {  
  7. UM.UserId,  
  8. THiting.Date,  
  9. THiting.GameTime,  
  10. THiting.Average,  
  11. THiting.Obp,  
  12. THiting.Single,  
  13. THiting.Double,  
  14. THiting.Triple,  
  15. THiting.Hr,  
  16. THiting.Hbp,  
  17. THiting.Bb,  
  18. THiting.Rbis,  
  19. THiting.Runs,  
  20. THiting.KSwinging,  
  21. THiting.LLooking,  
  22. THiting.RightOrLeftyPitcherWhatAtBat,  
  23. THiting.Lineout,  
  24. THiting.Groundout,  
  25. THiting.Popout,  
  26. THiting.Temperature  
  27. //PitchingDate = TPitching.Date,  
  28. //PitchingTime = TPitching.GameTime,  
  29. //TPitching.Ip,  
  30. //TPitching.PitchingStatsId,  
  31. //TPitching.Era,  
  32. //PitchingRun = TPitching.Runs,  
  33. //TPitching.Strikeouts,  
  34. //TPitching.Walks,  
  35. //PitchingHbp = TPitching.Hbp,  
  36. //PitchingLineout = TPitching.Lineout,  
  37. //TPitching.Popouts,  
  38. //PitchingGroundout = TPitching.Groundout,  
  39. //TPitching.FbVelo,  
  40. //TPitching.CbVelo,  
  41. //TPitching.SlVelo,  
  42. //TPitching.ChVelo,  
  43. //PitchingTemp = TPitching.Temperature  

Answers (1)