Can't do subselects in mysql

admin

Administrator
Staff member
Hi, i'm trying to make a simple message board and I need a bit of help to
finish up. Here's my database structure first with some example data:
TABLE: mboard
mid | topic | name | date
1 New site John Doe
2 Re: New site Susie Q

TABLE: mboardindex
mbiid | mid | message
1 1 1
2 1 2

mboard holds all the data and mboardindex holds what messages go with
what. In this case, mid = message = 1 indicates original message.
mid =1, message = 2 indicates reply to message 1.

Now, my problem is, i'm doing this in PHP4 and without subselects, i'm not
sure how to get the data to list like:

New site John Doe
Re: New site Susie Q

Here's my query:
SELECT * FROM mboard,mboardindex WHERE mboard.mid = mboardindex.mid ORDER
BY date

Well, this gets me everything with mboard.mid = mboardindex.mid = 1 (in
the case above).

Well, how do I get it mysql to select from the result of the above SELECT
statement. For example, I want to select the mboardindex.message from the
above select statement results. Normally, I would use a sub-select but we
can't do that in mysql. Can anyone help me out?

Thanks,
Mike
 
Back
Top