Is this the right SQL statement to show "friends"


I am making a social net site and want to display members friends depending on who is logged in.

i have the following code:-

            string sqlStrFr = "SELECT hussaini_friends.user_id, hussaini_friends.f_user_id, " +
                "hussaini_friends.status, hussaini_users.user_id, hussaini_users.fname, " +
                "hussaini_users.avatar FROM hussaini_friends INNER JOIN hussaini_users ON " +
                "hussaini_friends.f_user_id = hussaini_users.user_id " +
                "WHERE hussaini_friends.status = @status AND hussaini_users.user_id != @user_id";

            SqlCommand dbCommandFr = new SqlCommand(sqlStrFr, dbConn);
            dbCommandFr.Parameters.Add("@user_id", SqlDbType.Int).Value = System.Convert.ToInt32(Session["MEM_ID"].ToString());
            dbCommandFr.Parameters.Add("@status", SqlDbType.VarChar).Value = "Accepted";

            SqlDataReader dbReaderFr = dbCommandFr.ExecuteReader();

            if (dbReaderFr.HasRows)
                while (dbReaderFr.Read())
                    //Show member friends
                //Show no friends

Now i have the following table to check for friends:-

hussaini_friends{friend_id, user_id, f_user_id, status, date_added}

So i need to check that the status reads “Accepted” and that the user_id is of the user who is logged in…

but this SQL statement shows myself as being my own friend :rolleyes:

So any ideas how i can fix this?

probably because that’s what the data in the table indicates

by the way, if friend_id is an autonumber column, get rid of it