how to find unmatched row's for one user?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Masum Billah
    New Member
    • Nov 2010
    • 1

    how to find unmatched row's for one user?

    Lets say:
    userinfo table have (empid is Primary key):
    empid=========n ame
    100 ========= A
    101 ========= B
    102 ========= C
    103 ========= D
    104 ========= E

    <---my problem is here--->
    when this user (empid=100) login his account, he will see like below
    {empid=100 might not see him as friend himself :) }

    101 [add this user as friend] [delete this userfrom your list]
    102 [add this user as friend] [delete this userfrom your list]
    103 [add this user as friend] [delete this userfrom your list]
    104 [add this user as friend] [delete this userfrom your list]

    for example, he deleted some user from his list and other users will do so. So I am saving all records in one table.

    deleted_history table doesnt have PK:
    empid=========d eleted_id_from_ list
    100 ========= 101
    100 ========= 102
    103 ========= 101
    103 ========= 104

    My question is : I want to see like below output when empid=100 login his account, then he will see only non-deleted user id: output below:
    103 [add this user as friend] [delete this userfrom your list]
    104 [add this user as friend] [delete this userfrom your list]

    he won't see empid-101 and 102 anymore.
    same for other user empid=103, he will see only 102 and 103.

    I did some left join query but its giving me all records for both user(100 & 103)

    my query was :
    mysql> select userinfo.empid as 'ids' from userinfo Left Join deleted_history ON userinfo.empid= deleted_history .deleted_id_fro m_list where deleted_history .empid IS NULL;

    I will really appreciate if some one can help me AS SOON AS POSSIBLE. because I am stuck with it and I need to submit very soon.

    Thanks Again.
Working...