Amit Kumar
Amit Kumar

Reputation: 5962

how to write this in sql query to linq

This is my sql query.

 select category from category where id in(select cid from subcategory)

I want to write this in linq. how can I write this .

there is sample which i know , but this I'm unable to write this for my requirement

from n in objvar
               where new[] { "Amit", "Kumar", "XYZ" }.Contains(n.hello)
               select n

Upvotes: 0

Views: 58

Answers (1)

Rohit
Rohit

Reputation: 10246

A working solution would be

 var res= from c in Category
                    join
                        s in SubCategory on c.id equals s.cid
                    select c;

Upvotes: 1

Related Questions