Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql General > GROUP BY, ORDER...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 15471 of 15987
Post > Topic >>

GROUP BY, ORDER & LIMIT ?

by kynnjo@[EMAIL PROTECTED] ("Kynn Jones") May 6, 2008 at 01:22 PM

------=_Part_18171_7523051.1210094550914
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Suppose table X has two columns: class (TEXT) and size (INT).  I want a
listing showing the (up to) 5 largest values of "size" for each value of
"class" (for some values of "class" the total number of available records
may be less than 5).

What would be the simplest way to achieve such a listing?  It seems like
something one could do with GROUP BY, ORDER, and LIMIT, but I can't figure
out the right syntax for this query.

Thanks!

Kynn

------=_Part_18171_7523051.1210094550914
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

<br><div><br class="webkit-block-placeholder"></div><div><div><br
class="webkit-block-placeholder"></div><div><br
class="webkit-block-placeholder"></div><div>Suppose table X has two
columns: class (TEXT) and size (INT). &nbsp;I want a listing showing the
(up to) 5 largest values of &quot;size&quot; for each value of
&quot;class&quot; (for some values of &quot;class&quot; the total number
of available records may be less than 5).</div>
<div><br class="webkit-block-placeholder"></div><div>What would be the
simplest way to achieve such a listing? &nbsp;It seems like something one
could do with GROUP BY, ORDER, and LIMIT, but I can&#39;t figure out the
right syntax for this query.</div>
<div><br class="webkit-block-placeholder"></div><div>Thanks!</div><div><br
class="webkit-block-placeholder"></div><div>Kynn</div><div><br
class="webkit-block-placeholder"></div></div>

------=_Part_18171_7523051.1210094550914--
 




 3 Posts in Topic:
GROUP BY, ORDER & LIMIT ?
kynnjo@[EMAIL PROTECTED]   2008-05-06 13:22:30 
Re: GROUP BY, ORDER & LIMIT ?
david.t.wilson@[EMAIL PRO  2008-05-06 13:55:14 
Re: GROUP BY, ORDER & LIMIT ?
depesz@[EMAIL PROTECTED]   2008-05-06 20:04:08 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Sun Jul 6 18:44:50 CDT 2008.