Hi there.
Im making a kind of a messageboard and trying to save some time with the querys but i 
cant get it to work properly.


I have two tables, one with some users and one with messages.


Table : users
+----------+----+
| username | id |
+----------+----+
| user1    |  1 |
| user2    |  2 |
| user3    |  3 |
+----------+----+


Table : messages
+--------+---------+----+
| postid | replyid | id |
+--------+---------+----+
|      1 |      2  |  1 |
|      2 |      3  |  2 |
|      1 |      0  |  3 |
+--------+---------+----+


I have managed to create a query that selects row 1,2 but not row 3.
I want mysql to return row 3 but with a NULL value on the reply id (the message dont 
have a reply when first posted).


The output that im gettig follows...
+-------+-------+
| post  | reply |
+-------+------ +
| user1 | user2 |
| user2 | user3 |
+-------+-------+

The ouput that i would like to have...
+-------+-------+
|  post | reply |
+-------+------ +
| user1 | user2 |
| user2 | user3 |
| user1 | NULL  |
+-------+-------+


Thanks in advance.
/Håkan

Reply via email to