phpbar.de logo

Mailinglisten-Archive

Reccords zaehlen

Reccords zaehlen

Norbert Pfeiffer norbert at itbw.de
Die Feb 24 15:36:08 CET 2004


Hi Ruprecht,

okay - nun mit Beispiel und Ausgaben:

SELECT wr.name AS Artikel,
       SUM(ik.anzl) AS Menge,
       SUM(wr.cash * ik.anzl) AS Umsatz
FROM person AS ps,
     warens AS wr,
     imkorb AS ik,
     basket AS bs
WHERE bs.bsID = ik.bsID
  AND bs.kost = ps.kost
  AND ik.waID = wr.waID
GROUP BY wr.name;

SELECT COUNT(*)
FROM person AS ps,
     warens AS wr,
     imkorb AS ik,
     basket AS bs
WHERE bs.bsID = ik.bsID
  AND bs.kost = ps.kost
  AND ik.waID = wr.waID
GROUP BY wr.name;

SELECT COUNT(*)
FROM person AS ps,
     warens AS wr,
     imkorb AS ik,
     basket AS bs
WHERE bs.bsID = ik.bsID
  AND bs.kost = ps.kost
  AND ik.waID = wr.waID;

+------------------+-------+-----------+
| Artikel          | Menge | Umsatz    |
+------------------+-------+-----------+
| Adressstempel    |    15 | 229.95000 |
| Briefpapier      |    17 |  39.61000 |
| Brief÷ffner      |    19 |  37.81000 |
| Fineliner, (0,1) |    27 |  35.91000 |
| Haftnotitzblock  |    17 |  94.35000 |
| Locher (4-loch)  |    11 |  54.89000 |
| Schreibunterlage |    20 |  79.80000 |
| Tischrechner     |    15 | 128.25000 |
| Zettelblock      |    18 |  53.82000 |
+------------------+-------+-----------+
9 rows in set (0.00 sec)
+----------+
| COUNT(*) |
+----------+
|        5 |
|        4 |
|        5 |
|        5 |
|        5 |
|        4 |
|        5 |
|        4 |
|        4 |
+----------+
9 rows in set (0.00 sec)
+----------+
| COUNT(*) |
+----------+
|       41 |
+----------+
1 row in set (0.00 sec)

benoetigt wird aber:
+----------+
| COUNT(*) |
+----------+
|        9 |
+----------+
damit man blaettern kann,
wenn die Ausgabe 10 Zeilen uebersteigt ...


m. b. G. Norbert
_____________________
normal:  02686-987103
Notruf:  0177-2363368
---------------------
e.o.m.


-- 
Infos zur Mailingliste, zur Teilnahme und zum An- und Abmelden unter
-->>  http://www.4t2.com/mysql 


php::bar PHP Wiki   -   Listenarchive