try this (sql server):
declare @users table (userid int primary key identity(1,1), name varchar(10), profilepic char(1))
declare @friendships table (id int primary key identity(1,1), userid int, friendid int, datecreated datetime)
insert into @users values ('bill','b')
insert into @users values ('matt','m')
insert into @users values ('steve','s')
insert into @users values ('fred','f')
insert into @users values ('joe','j')
insert into @friendships values (1,2,'8/24/2008')
insert into @friendships values (1,3,'8/24/2008')
insert into @friendships values (2,1,'8/24/2008')
insert into @friendships values (2,3,'8/24/2008')
insert into @friendships values (4,1,'8/24/2008')
insert into @friendships values (4,5,'8/24/2009')
--all firends
select
u.*
FROM @users u
INNER JOIN (select
userid
FROM @Friendships
WHERE friendid=1
UNION
select
friendid
FROM @Friendships
WHERE userid=1
) dt ON u.userid=dt.userid
--new firends of friends
select
u.*
FROM (select
userid
FROM @Friendships
WHERE friendid=1
UNION
select
friendid
FROM @Friendships
WHERE userid=1
) dt
INNER JOIN @friendships f ON dt.userid=f.userID
INNER JOIN @users u ON f.friendid=u.userid
WHERE f.datecreated>=GETDATE()-14 --2 weeks
OUTPUT
userid name profilepic
----------- ---------- ----------
2 matt m
3 steve s
4 fred f
(3 row(s) affected)
userid name profilepic
----------- ---------- ----------
5 joe j
(1 row(s) affected)