Guest User

Untitled

a guest
Aug 18th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. How to determine whether to use join in linq to sql?
  2. Table 1 Customer
  3. id
  4. name
  5.  
  6. Table 2 addresstype
  7. id
  8. address1
  9. customerid
  10.  
  11. var address = from cu in Customer
  12. from ad in addresstype
  13. where cu.id == ad.customerid
  14. select ad;
  15.  
  16. var address = from cu in Customer
  17. join ad in addresstype on cu.id equals ad.customerid
  18. select de;
  19.  
  20. select ad.*
  21. from Customer cu, AddressType ad
  22. where cu.ID == ad.CustomerID -- I assume this was meant by the OP
  23.  
  24. select ad.*
  25. from Customer cu
  26. inner join AddressType ad on cu.id = ad.CustomerID;
  27.  
  28. new {X,Y} equals new {X',Y'}
  29.  
  30. var query = from cu in Customer
  31. from ad in cu.Addresses
  32. select ad;
Add Comment
Please, Sign In to add comment