SELECT a.id, a.title, a.title_alias, a.hits, a.created_by, a.created_by_alias, a.created AS created, a.access, gb.bandname AS author, a.state, g.name AS groups
FROM #__content AS a
LEFT JOIN #__content_authors AS ca ON ca.contentid = a.id
LEFT JOIN #__gigcal_bands AS gb ON gb.gigcal_bands_id = ca.authorid
LEFT JOIN #__users AS u ON u.id = a.created_by
LEFT JOIN #__groups AS g ON a.access = g.id
WHERE a.state = 1
AND ( publish_up = '0000-00-00 00:00:00' OR publish_up <= '2010-09-09 05:42' )
AND ( publish_down = '0000-00-00 00:00:00' OR publish_down >= '2010-09-09 05:42' )
AND a.catid = 31
AND a.access <= 0
AND 0 <= 0
AND a.sectionid = 1
GROUP BY a.id
ORDER BY a.created DESC
