Unanswered: how to sort and return first few tuples.
I have a table with 3 attributes, id (primary key, int), tag and count... i need to return first 50 tags, after sorting the tags by count in descending order (to choose the first 50 most popular tags).. I need to create a function for this. I am thinkin of creating a temperory table to store sorted tags, and then select the first 50 frm the new table...but i m not sure how to select top few tuples.... is there sum way to have a counter within the loop that is used to return values?
I m not sure how to this in postgreSQL...so i wuld really appreciate it if sumone culd help with this..thnx.