Forum Moderators: coopster
Has anyone on this site used PEAR-MDB2 package to perform join queries and tried to extract the results? I can create the join queries and they get executed fine. I can extract columns of the current table (sections table in the following example) from the results but not the info from the joined tables (rows and cells). Or do I need to learn Doctrine also just to execute the join queries?
Any help is greatly appreciated. Sad part is there is no documentation available.
Thanks
Su Ti
------------------------------------
SELECT sections.sectionid, cells.* FROM sections
INNER JOIN rows ON sections.sectionid=rows.sectionid
INNER JOIN cells ON rows.rowid=cells.rowid
CREATE TABLE IF NOT EXISTS `sections` (
`SectionId` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`SectionName` varchar(10) NOT NULL,
PRIMARY KEY (`SectionId`),
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
CREATE TABLE IF NOT EXISTS `rows` (
`RowId` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`RowName` varchar(10) NOT NULL,
`SectionId` mediumint(8) unsigned NOT NULL,
PRIMARY KEY (`RowId`),
KEY `SectionsRows` (`SectionId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;
CREATE TABLE IF NOT EXISTS `cells` (
`CellId` int(10) unsigned NOT NULL AUTO_INCREMENT,
`RowId` mediumint(8) unsigned NOT NULL,
`CellName` varchar(5) NOT NULL,
PRIMARY KEY (`CellId`),
KEY `RowsCells` (`RowId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ;