All pastes #639808 Raw Edit

Unnamed

public text v1 · immutable
#639808 ·published 2007-07-30 21:30 UTC
rendered paste body
SELECT a.id, a.name, a.shortname, a.sitetype, a.primary_cat, c.review_date, '0' AS our_score, c.review_status, a.added AS overallDate, d.title AS catname, e.shortname AS sitetypename, MIN( f.amount ) AS trial, MIN( g.amount ) AS monthly, inc.includedttl
FROM tbp_sites a
LEFT JOIN tbpv2_sites_status b ON a.id = b.siteid
LEFT JOIN tbpv2_sites_reviews c ON b.reviewid = c.id
LEFT JOIN tbp_list_categories d ON a.primary_cat = d.id
LEFT JOIN tbp_list_sitetypes e ON a.sitetype = e.id
LEFT JOIN tbp_cost_options f ON a.id = f.siteid
AND 2 = f.cost_option
LEFT JOIN tbp_cost_options g ON a.id = g.siteid
AND 3 = g.cost_option
LEFT JOIN tbp_list_clone y ON a.clone_type = y.id
LEFT JOIN tbpv2_sites_included_count inc ON a.id = inc.siteid
WHERE (
y.clone_status IS NULL
OR y.clone_status !=2
)
AND b.site_status =2
GROUP BY a.id
ORDER BY a.added DESC
LIMIT 20