You are here: mysql limit... need TOP 20 not FIRST 20.... « PHP SQL « IT news, forums, messages
mysql limit... need TOP 20 not FIRST 20....

Posted by toedipper on 07/13/05 01:31

Hello,

I have the folowing query.

SELECT sw.swid, title, shortdesc, version, catid, count(dl.swid),warename
FROM software sw
LEFT JOIN downloads dl ON sw.swid = dl.swid
JOIN waretypes wt ON sw.wareid = wt.wareid
WHERE liveyn = 'y'
GROUP BY
sw.swid, title, shortdesc, version, catid
limit 20


It works but it just gives me the first 20 records. I select from a
software table and then join to a downlaods table and count instances of
a software id, each instance is a downloand.

What I really want is for the 20 to show the TOP 20 downloads
(instances. I think what I am looking for is an equivalent statement to
the TOP in MS Sql.

Any ideas?


Thanks,

td.

SELECT sw.swid, title, shortdesc, version, catid, count(dl.swid),warename
FROM software sw
LEFT JOIN downloads dl ON sw.swid = dl.swid
JOIN waretypes wt ON sw.wareid = wt.wareid
WHERE liveyn = 'y'
GROUP BY
sw.swid, title, shortdesc, version, catid
limit 20

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация