----- Original Message ----- From: "A.L.E.C" alec@alec.pl To: "lista użytkowników LMS" lms@lists.lms.org.pl Sent: Wednesday, September 19, 2007 2:30 PM Subject: Re: [lms] Zapytanie SQL
tdabek@go2.pl wrote:
select COUNT(nodes.id) AS il_kompow,customers.name AS name,customers.lastname AS lastname,customers.id AS id from nodes, customers where nodes.ownerid=customers.id GROUP BY ownerid HAVING COUNT(nodes.id)>0;
To zapytanie zwraca mi wszystkich klientow i podaje liczbe komputerow, ale nie potrafie zmodyfikowac aby wyodrebnilo z tego tylko tych co posiadaja wiecej niz jeden komputer.
SELECT ownerid ,customers.lastname
FROM nodes,customers
WHERE ownerid > 0 and ownerid=customers.id GROUP BY ownerid HAVING COUNT(*)> 1
_______________________________________________ lms mailing list lms@lists.lms.org.pl http://lists.lms.org.pl/mailman/listinfo/lms