We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

how to get data from multiple table(more than 2 table) in linq to entity.

Medium Priority
382 Views
Last Modified: 2013-11-11
i ahve a 4 table as

1stockbyname
2.stocktrans
3.Mystock
4.product

Mystock
productid
qty


product
productid
productname


stockbyname
stockid
serviceid


stocktrans
stockid
price
amount

how to get data from multiple table(more than 2 table) in linq to entity.



well i want to fetch data from all four table on base of stock id,i tried it and found that
linq to entity work for only two table not for the multiple table,i dont know how to retrive data from multiple table,
could any expert let me know how i do it
Comment
Watch Question

Do the stock ID fields in the last two tables relate directly to the product ID fields in the first two?  What is your primary relationship that logically relates all four tables?

Author

Commented:
sorry forget to add product id in product table.and stock id and product id are primary key.

Mystock
productid
qty


product
productid
productname


stockbyname
stockid
serviceid


stocktrans
stockid
price
amount
productid

see stockbyname  have a primary key stock id which is related to stoctrans-->stock id,through this stock id i will get product id from stocktrans.now from this product id i ahve to fetch quantity and product name from table mystock and product..

could you plese provide the way to write down query
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
thanks
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.