Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE (friend_id_a, friend_id_b, accepted)
- INSERT
- INTO friend_friend(friend_id_a, friend_id_b)
- VALUES (LEAST(@id1, @id2), GREATEST(@id1, @id2))
- SELECT friend_id_b
- FROM friend_friend
- WHERE friend_id_a = @id
- AND accepted
- UNION ALL
- SELECT friend_id_a
- FROM friend_friend
- WHERE friend_id_b = @id
- AND accepted
- [dbo].[Users]{
- User_ID int,
- UserName VarChar,
- Password ...
- }
- [dbo].[Friends]{
- User1_ID int,
- User2_ID int,
- Accepted bit
- }
Add Comment
Please, Sign In to add comment