title: Select Master Data From Table Based on Categories From Multiple Tables
body: <p>I have Tables Like</p>
  
  <p>1) User Which Holds The Master Data Like</p>
  
  <pre>
  User ID   Name    OtherColumns
  1         Banshi   Nothing
  2         Banshi2  Nothing 
  3         Banshi3  Nothing </pre>
  
  <hr>
  
  <p>2)Second Table "Friends" Holds Data Like</p>
  
  <pre>
  ID    UserID     FriendID    FriendCategory
  1       1          2             2
  2       2          1             2
  3       4          1             2
  4       1          4             2</pre>
  
  <hr>
  
  <p>3)Third Table "Subscribers" Holds Data Like</p>
  
  <pre>
  ID    SubscribersID  SubscribToID    FriendCategory
  1       1              3                  3
  2       1              4                  3</pre>
  
  <hr>
  
  <p>4)Fourth Table "FriendCategory" Like</p>
  
  <pre>
  ID      Name
  2       Friends
  3       Subscribers</pre>
  
  <hr>
  
  <p>5)Fifth Table "Posts" Contains Data Like</p>
  
  <pre>
  PostID   UserID  Post           
  1         2      Hello Dear Post By Banshi2
  2         3      Hello Dear  Post By Banshi3
  3         4     Hello Dear  Post By Banshi4 </pre>
  
  <hr>
  
  <p>Now Being User 1 i Need Data Like
  A) I need Data if Posted By My Friends
  B) I need Data if Posted By i am Subscribed to
  c) If User is My Friend Subscribed as Well Then it Must Show Friend not i am Subscribed</p>
  
  <h2>My Data Something Like</h2>
  
  <pre>
  
  UserID      Name        Post                          Category
  2          Banshi2    Hello Dear Post By Banshi2     Friends
  3          Banshi3    Hello Dear Post By Banshi3     I Am Subcriber 
  4          Banshi4    Hello Dear Post By Banshi4     Friends
  </pre>
  
  <p>Please Suugest Me How to Get Such a Out put in Sql Server 2008</p>
  
  <p>Thanks in Advance
  Banshi</p>