You should definitely read up the manual.  If you don't do this, will not do
you homework and simply expect an answer handed down to you, you might get
disappointed.  Question you have asked is like MySQL 101.  To get you started
this time, however, here it is:

select * from table bands order by views DESC limit 2;

Tyler Longren wrote:

> I've got a table that contains a list of bands.  There's a field named
> views.  This field contains how many times each band's page has been viewed.
>
> Ex:
> id      artist  views
> 1       No names        6
> 2       WISH            10
> 3       Deftones        45
>
> What's the SQL to select the top 2 most viewed bands(which would be WISH &
> Deftones)?  I've tried a few things, but haven't gotten anything to work
> correctly for me.  Thanks.
>
> Tyler Longren
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

--
Bolek,

URL: http://www.bolek.com
URL: http://slash.bolek.com
e-mail: [EMAIL PROTECTED]
ICQ: 4086197, Address: 402905326




---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to