[SQL] query nodig voor 2de column op te tellen

Pagina: 1
Acties:
  • 25 views sinds 30-01-2008

  • NoFate
  • Registratie: Januari 2003
  • Laatst online: 12:42
Hallo,

Ik heb een query nodig om dit uit te voeren

artikel count
1003 4
1002 5
1004 1
1003 4

en het moet dit worden :

artiikel count
1002 5
1003 8
1004 1

Dus eigenlijk moet er een distinct genomen worden van de eerste kolom en de bijhorende 2de kolom moet opgeteld worden
Is dit mogelijk?


Bedankt

  • Gomez12
  • Registratie: Maart 2001
  • Laatst online: 17-10-2023
select artikel, sum(count)
from test
group by artikel
order by artikel asc.

Oftewel gewoon sql cursus volgen...

[ Voor 20% gewijzigd door Gomez12 op 02-07-2005 18:18 ]


  • Mischa_NL
  • Registratie: Mei 2004
  • Laatst online: 01-02-2023
beetje basisvraagje inderdaad,

www.w3schools.com daar vind je een hoop basisSQL!
Ook onder andere group by en union heel het handeltje dus als je eens vast zit vind je het meestal daar wel ;).

  • NoFate
  • Registratie: Januari 2003
  • Laatst online: 12:42
ah is het zo simplel :-)

thnx a lot guys :)

  • NMe
  • Registratie: Februari 2004
  • Laatst online: 15-04 22:07

NMe

Quia Ego Sic Dico.

Basic dus, volgende keer even wat beter zoeken. :)

'E's fighting in there!' he stuttered, grabbing the captain's arm.
'All by himself?' said the captain.
'No, with everyone!' shouted Nobby, hopping from one foot to the other.


Dit topic is gesloten.