Hi,
It seems like what you are trying to do is select all messages
that have child messages and display the results sorted by the
parent message ID.
How about...
select
messages.message_id,
messages_1.message_id
from
messages,
connections,
messages messages_1
where connections.parent = messages.message_id
and messages_1.message_id = connections.child
order by
messages.message_id,
messages_1.message_id;
Or more clearly...
select
parent_msg.message_id,
child_msg.message_id
from
messages parent_msg,
connections connect,
messages child_msg
where connect.parent = parent_msg.message_id
and child_msg.message_id = connect.child
order by
parent_msg.message_id,
child_msg.message_id;
Stephen
P.S. I am not an expert on MS Access and whether your original query would
include parent messages which have no children (via "connections") or not.
If so, you would need to enhance the suggested SQL with some MySQL version
of INNER or OUTER join syntax.
At 05:40 PM 7/25/2001 +0200, Zbigniew Szczesny wrote:
>Hello !
>
>This is a syntax taken from MS Access:
>
>SELECT messages.message_id, messages_1.message_id
>FROM messages AS messages_1 INNER JOIN (messages INNER JOIN connections ON
messages.message_id = connections.parent) ON messages_1.message_id =
connections.child
>ORDER BY messages.message_id, messages_1.message_id
>
>For whatever reason this syntax is not valid for MySQL.
>
>Please - help me to write the right equivalent one.
>
>Thank you for your help !
>Ziggi
>
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php