JOIN (SELECT listing_id,count(listing_id) AS count FROM cls.tagslistings
WHERE cust_id =27
AND tag_id IN (SELECT tag_id FROM cls.tags WHERE tag_name IN ('toys','263'))
GROUP BY listing_seq_id
) AS X ON X.listing_id= a.listing_id
ORDER by X.count DESC
R. Verghese
Author: Zac Date: 2005-06-29 05:12 -700To: pgsql-sql Subject: Re: [SQL] ORDER records based on parameters in IN clause
> SELECT > table.* > FROM > table > JOIN (SELECT id, count(id) AS count FROM... your subquery) AS x > ORDER BY > x.count > > Bye. Sorry: I forgot join condition: SELECT
table.*
FROM
table
JOIN (SELECT id, count(id) AS count FROM... your subquery) AS x ON