List:General Discussion« Previous MessageNext Message »
From:Wm Mussatto Date:September 5 2007 4:02pm
Subject:RE: Simple questio SQL
View as plain text  
On Wed, September 5, 2007 7:17, Jay Blanchard said:
> [snip]
> I have a Table and want to know the most visited products.
> Products
>
> -          Id
>
> -          Name
>
> -          Visited
> [/snip]
>
> SELECT Id, Name, count(Visited) AS Total_Visits FROM product GROUP
> BY(Id)
  order by Total_Visits desc limit 5
That should get you the top 5 from most to least visited.

------
William R. Mussatto
Systems Engineer
http://www.csz.com
909-920-9154

Thread
Simple questio SQLTomas Abad5 Sep
  • Re: Simple questio SQLMartijn Tonies5 Sep
  • RE: Simple questio SQLJay Blanchard5 Sep
  • Re: Simple questio SQLAlex Arul Lurthu5 Sep
  • RE: Simple questio SQLWm Mussatto5 Sep