Difference between revisions of "NejvicVypujcek"
From Wikivyuka
m |
|||
Line 1: | Line 1: | ||
− | SELECT Count(id_ex) AS pocetVypujcek, c_cten | + | SELECT Count(id_ex) AS pocetVypujcek, c_cten |
− | FROM VYPUJCKA AS v | + | FROM VYPUJCKA AS v |
− | GROUP BY c_cten; | + | GROUP BY c_cten; |
Tento dotaz ulozime pod nazvem pocetVyp a pouzijeme jej jako vstup do dalsiho dotazu: | Tento dotaz ulozime pod nazvem pocetVyp a pouzijeme jej jako vstup do dalsiho dotazu: | ||
− | SELECT TOP 1 Max(pocetVyp.pocetVypujcek) AS MaxOfpocetVypujcek, CTENAR.prijmeniC | + | SELECT TOP 1 Max(pocetVyp.pocetVypujcek) AS MaxOfpocetVypujcek, CTENAR.prijmeniC |
− | FROM pocetVyp INNER JOIN CTENAR ON pocetVyp.c_cten = CTENAR.c_cten | + | FROM pocetVyp INNER JOIN CTENAR ON pocetVyp.c_cten = CTENAR.c_cten |
− | GROUP BY pocetVyp.c.c_cten, pocetVyp.pocetVypujcek, CTENAR.prijmeniC | + | GROUP BY pocetVyp.c.c_cten, pocetVyp.pocetVypujcek, CTENAR.prijmeniC |
− | + | ORDER BY pocetVyp.pocetVypujcek desc; | |
+ | |||
+ | [http://gis.vsb.cz/wikivyuka/index.php/Datab%C3%A1zov%C3%A9_syst%C3%A9my_-_cvi%C4%8Den%C3%AD Zpět na stránku DBS - cvičení] |
Revision as of 06:24, 22 November 2011
SELECT Count(id_ex) AS pocetVypujcek, c_cten FROM VYPUJCKA AS v GROUP BY c_cten;
Tento dotaz ulozime pod nazvem pocetVyp a pouzijeme jej jako vstup do dalsiho dotazu:
SELECT TOP 1 Max(pocetVyp.pocetVypujcek) AS MaxOfpocetVypujcek, CTENAR.prijmeniC FROM pocetVyp INNER JOIN CTENAR ON pocetVyp.c_cten = CTENAR.c_cten GROUP BY pocetVyp.c.c_cten, pocetVyp.pocetVypujcek, CTENAR.prijmeniC ORDER BY pocetVyp.pocetVypujcek desc;