A mysql question...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hai all,

I have two tables a and b as follows to implement a simple block list where
users can block other users.....
Table A

+------------+--------------+------+

| Name | phone |userid|

+------------+--------------+------+

| Mr Sasi | 01225 708225 | 1 |

| Miss Brown | 01225 899360 | 2 |

| Mr Black | 01380 724040 | 3 |

+------------+--------------+------+
Table B

+------------+--------------+

| blockedbyid| blockedid |

+------------+--------------+

| 1  | 2 |

| 2 | 3 |

| 1 | 3 |

+------------+--------------+

"blockedbyid" is id of user who has blocked the user in "blockedid".

I need to join the two tables and fetch all records from table A such that
the result has all users who are not blocked by a particular user [ie
blockedbyid='XXX'].. Can you guys give the SQL query so that i can fetch the
records as a recordset??? I dont want to fetch two different rowsets and
compare it in php.... Correct me if my db structure is wrong.....
regards,
Midhun Girish

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux