PDA

View Full Version : ordering by average when selecting columns


sabret00the
07-12-2005, 03:05 PM
how would i go about that?

this is what i tried but gives me error 1111
SELECT *, prs_pieces.pieceid AS pieceid, prs_pieces.title AS title, prs_pieces.pagetext AS pagetext, user.username AS username, NOT ISNULL(avatardata) AS hascustom, customavatar.dateline AS avatardateline, prs_reviews.username AS reviewer, prs_reviews.dateline AS reviewdateline, prs_info.reviewcount AS reviewcount
FROM prs_pieces
LEFT JOIN prs_categories ON (prs_categories.catid = prs_pieces.catid)
LEFT JOIN prs_sections ON (prs_sections.sectionid = prs_categories.sectionid)
LEFT JOIN prs_reviews ON (prs_reviews.pieceid = prs_pieces.pieceid)
LEFT JOIN prs_info ON (prs_info.pieceid = prs_pieces.pieceid)
LEFT JOIN user AS user ON (user.userid = prs_pieces.userid)
LEFT JOIN avatar AS avatar ON (avatar.avatarid = user.avatarid)
LEFT JOIN customavatar AS customavatar ON (customavatar.userid = user.userid)



ORDER BY AVG(prs_reviews.rating) DESC

got it sorted, in short it was rejecting the "*,"