8 Lis
2007
8 Lis
'07
13:49
ICE wrote:
klientów czy ich komputery?
chodzi oczywiscie o klientow,a nie o ich komputery ;) spróbuj jakoś tak:
SELECT DISTINCT c.id, c.lastname, c.name, COALESCE(cash.balance, 0)
FROM customers c JOIN customerassignments a ON (a.customerid = c.id) LEFT JOIN ( SELECT SUM(value) AS balance, customerid FROM cash GROUP BY customerid ) cash ON (cash.customerid = c.id) WHERE a.customergroupid IN (3,5,25) OR (a.customerid = 4 AND (cash.balance != 0 AND cash.balance IS NOT NULL))
-- Aleksander 'A.L.E.C' Machniak http://alec.pl gg:2275252 LAN Management System Developer http://lms.org.pl _______________________________________________ lms mailing list lms@lists.lms.org.pl http://lists.lms.org.pl/mailman/listinfo/lms