So I've been working with this :
SELECT DISTINCT l.*
FROM StreamView l
JOIN Friendships f ON f.Sender = @UserName OR f.Recipient = @UserName
WHERE l.Sender <> @UserName
AND l.Recipient <> @UserName
AND ( l.Sender = f.Recipient
OR l.Sender = f.Sender
OR l.Recipient = f.Sender
OR l.Recipient = f.Recipient)
ORDER BY DateTime DESC
It works great for getting a list of required records. Anyhow I would like to be able to give this query two new attributes, from which row to start getting records from and a second integer that defines the length.
The reason for this is that I am applying 'lazy scrolling' effect on this data.
I would like to add these two values into the query: (Int32 startAt, Int32 howMany)
Any ideas? Thanks.