SQL SELECT * FROM `sections` WHERE `topsectionid` = '20' AND `2ndsectionid` > '0' AND `3rdsectionid` = '0' AND `showonweb` = 'Yes' ORDER BY `topsectionid`,`2ndsectionid`,`3rdsectionid`