+ $qry = 'SELECT notice.*, '.
+ $weightexpr . ' as weight ' .
+ 'FROM notice JOIN fave ON notice.id = fave.notice_id ' .
+ 'GROUP BY id,profile_id,uri,content,rendered,url,created,notice.modified,reply_to,is_local,source ' .
+ 'ORDER BY weight DESC';