Jump to content

Self join


ram4nd

Recommended Posts

I have this sql query:

Select 
mos_users.username, 
mos_sb_messages_text.message, 
mos_sb_messages.parent, 
mos_sb_messages.subject, 
mos_sb_messages.time, 
mos_sb_messages.ip

from 
mos_sb_messages, 
mos_users, 
mos_sb_messages_text

where
mos_sb_messages_text.mesid = mos_sb_messages.id and
mos_sb_messages.userid = mos_users.id and
mos_sb_messages.parent != 0

 

I want to use the parent field to do a join. I want to join parents to fields that have parents. So it would display parent subject and message in same row with subs.

 

I had hard time trying to explain what I want to do, I hope everybody understands what I try to achieve.

Link to comment
https://forums.phpfreaks.com/topic/195988-self-join/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.