I know this question comes up often, but today I can't find the answer I'm looking for. I have a table with this schema.
CREATE TABLE `comments` (
`id` bigint(10) unsigned not null auto_increment,
`parent_id` bigint(10) unsigned default 0,
`date_sent` datetime not null,
`content` text not null,
PRIMARY KEY(`id`)
) ENGINE=InnoDB;
I'd like to select parent rows, and the children of those rows. I don't allow children to have children, so it's just one parent, with any number of children.
I think I've seen this done with unions before, or inner joins.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…