vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| > I have a Table and want to know the most visited products. > > > > Products > > - Id > > - Name > > - Visited > > > > Visited is numeric. How about: select * from Products order by Visited desc ? Martijn Tonies Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle & MS SQL Server Upscene Productions http://www.upscene.com My thoughts: http://blog.upscene.com/martijn/ Database development questions? Check the forum! http://www.databasedevelopmentforum.com |
| |||
| select * from Products order by Visited desc limit 10; should give you the top 10 products. On 9/5/07, Tomas Abad <informatica@vipventa.com> wrote: > > HI All, > > > > I have a Table and want to know the most visited products. > > > > Products > > - Id > > - Name > > - Visited > > > > Visited is numeric. > > -- Thanks Alex http://alexlurthu.wordpress.com |
| ||||
| 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 |