Click here to Skip to main content
15,860,972 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey guys, I have 3 tables which I need to return a set of results from. The application is written in c# and all the data is got using linq to sql. the tables are User, PermissionGroup and Subscription, The user and Permission table can both have an entry in the Subscription table, so I wanna return all the Subscriptions that each User or Permission Group have. It is pretty easy to do in sql but it's not whay I need here. Any help is very much apreciated. Thanks guys
Posted

1 solution

i have an example ..may it will help you



XML
var albums = (from a in db.artists
                          where a.artistId == 1
                          join sb in db.singbies on a equals sb.artist
                          join t in db.tracks on sb.track equals t
                          join al in db.albums on t.album equals al
                          select al).Distinct();

return albums.ToList() as List<album>;



or you can past ur simple sql query then i will convert it to linq to sql
 
Share this answer
 
Comments
frostcox 26-Oct-12 11:28am    
select * from Subscription s inner Join
PermissionGroup pg on s.SubscriberLinkId = pg.PermissionGroupId inner join
DeliverFileSetting df on df.DeliverFileSettingId on s.SubscriptionLinkId
where @PermissionGroupId = SubscriberLinkId

Thanks very much for your help

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900