Dipa Ahuja

Dipa Ahuja

  • NA
  • 3.1k
  • 714.3k

data from two tables. delete query

Mar 22 2010 2:37 PM
hi i am making social networking website

i want to retrieve and delete data from my friend's table.. that is profile table and friends table

friend table has field (friend_Id, my_Id, fstatus etc)

and profile table all fields of profile like profile image, firstname,lastname, city etc

for select command i got help from one social networking example which is like this way :

<asp:SqlDataSource ID="friendsq" runat="server" 
       ConnectionString="<%$ ConnectionStrings:ConnectionString2 %>"

 SelectCommand="select * from profile where profileId IN (Select my_Id as profileId from friends where friend_Id=@profileId AND fstatus=1 UNION select friend_Id as ProfileId from friends where my_Id=@profileId AND fstatus=1)">
<SelectParameters>
            <asp:ProfileParameter Name="profileId" PropertyName="profile_Id" />                                            
      </SelectParameters>
 </asp:SqlDataSource>

this will display all friends of user who is "logged in"

now i am confuse about the delete query...

how we can specify delete query to delete friend from friend's table...

Answers (6)