SQL: SELECT a. * , t. * , count( DISTINCT a.tid ) FROM [Table]attachments a, [Table]threads t WHERE a.tid = (SELECT t.tid FROM [Table]threads t WHERE t.attachment =2 ORDER BY dateline DESC ) GROUP BY a.tid LIMIT 0,30
Error: Subquery returns more than 1 row