w samplach jest przykład dla radiusa.
a zrobiłem to tak:
SELECT lower(
nn.name) as Nazwa,inet_ntoa(nn.ipaddr) as adres, z.downceil,z.upceil FROM nodes nn
LEFT JOIN (
SELECT
n.id, MIN(
n.name) AS name, SUM(t.downceil) AS downceil, SUM(t.upceil) AS upceil
FROM nodeassignments na
JOIN assignments a ON (na.assignmentid =
a.id)
JOIN tariffs t ON (a.tariffid =
t.id)
JOIN nodes n ON (na.nodeid =
n.id)
JOIN (
SELECT assignmentid, COUNT(*) AS cnt
FROM nodeassignments
GROUP BY assignmentid
) o ON (o.assignmentid = na.assignmentid)
WHERE (a.datefrom <= unix_timestamp() OR a.datefrom = 0)
AND (a.dateto > unix_timestamp() OR a.dateto = 0)
AND a.suspended = 0
GROUP BY
n.id) z ON
z.name =
nn.name WHERE nn.ipaddr BETWEEN inet_aton('x.x.x.x') and inet_aton('x.x.y.y')
ORER BY Nazwa
co prawda może mało ładne, ale otrzymuję to co chciałem :)