Difference between revisions of "NejvicVypujcek"

From Wikivyuka
Jump to: navigation, search
 
m
 
(One intermediate revision by the same user not shown)
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 pocetVyp.pocetVypujcek AS NejvicVypujcek, 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
+
ORDER BY pocetVyp.pocetVypujcek desc;
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í]

Latest revision as of 11:44, 5 December 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 pocetVyp.pocetVypujcek AS NejvicVypujcek, CTENAR.prijmeniC
FROM pocetVyp INNER JOIN CTENAR ON pocetVyp.c_cten = CTENAR.c_cten
ORDER BY pocetVyp.pocetVypujcek desc;

Zpět na stránku DBS - cvičení