All pastes #2054304 Raw Edit

Someone

public text v1 · immutable
#2054304 ·published 2011-05-05 18:01 UTC
rendered paste body
user us = u.ToArray()[0];

//select all accepted friends
var fquery = from x in db.users
                join y in db.friend_list on x.id equals y.f_id
                where (y.u_id == us.id) && (y.status == 2)
                select x;

//select friend timeline posts
var pquery = from friend in fquery
                join post in db.game_timeline on friend.id equals post.user_id
                join user in db.users on post.friend_id equals user.id into userGroup
                join game in db.games on post.game_id equals game.game_id into gameGroup
                select new 
                {
                    Friend = friend,
                    Post = post,
                    Recipient = userGroup,
                    Game = gameGroup
                };