🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: be.comp.programming
3 messages
3 total messages Started by drukqs Sat, 17 May 2003 13:38
query vraagje
#5272
Author: drukqs
Date: Sat, 17 May 2003 13:38
14 lines
1389 bytes
Hoi

Ik zou de artikelen die het meest voorkomen moeten sorteren. Dus artikel1 
komt 10 keer voor => staat bovenaan. Artikel5 komt 9 keer voor => staat 2e. 
je begrijpt het wel. Dit is wat ik heb

select max(count(artikelnr))
from artikels
group by artikelnr

Maar dan geeft hij enkel het artikelnr dat het meest voorkomt. Ik wil ze 
dus allemaal zien, aflopen. Kan iemand wat helpen. 

Bedankt.
Re: query vraagje
#5273
Author: Gunter Schelfhout
Date: Sat, 17 May 2003 13:59
20 lines
1619 bytes
drukqs wrote:

> Hoi
> 
> Ik zou de artikelen die het meest voorkomen moeten sorteren. Dus artikel1
> komt 10 keer voor => staat bovenaan. Artikel5 komt 9 keer voor => staat
> 2e. je begrijpt het wel. Dit is wat ik heb
> 
> select max(count(artikelnr))
> from artikels
> group by artikelnr
> 

SELECT artikelnr, count(artikelnr) AS stock
FROM artikels
GROUP BY artikelnr
ORDER BY stock DESC

-- 
Blood, sweat & tears
Re: query vraagje
#5274
Author: drukqs
Date: Sat, 17 May 2003 14:06
8 lines
1320 bytes
Gunter Schelfhout wrote in news:Verxa.6257$1u5.430@afrodite.telenet-ops.be:

> SELECT artikelnr, count(artikelnr) AS stock
> FROM artikels
> GROUP BY artikelnr
> ORDER BY stock DESC

Bedankt voor de snelle reactie.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads