I have a problem with the query shown below. It always returns the same value for both snapshot and adm. Also the values returned are not what I woluld expect.
SELECT
domains.name, count(snapshot_info.snapshot_uuid) as snapshot, count(users_domains.uuuid) as adm
FROM
domains, snapshot_info, users_domains
WHERE
domains.duuid = snapshot_info.duuid
AND
users_domains.duuid = domains.duuid
group by name;
Returns:
domain1 33 33
domain2 40 40
domain3 3 3
This query works and returns the correct values
SELECT
domains.name, count(snapshot_info.snapshot_uuid) as snapshot
FROM
domains, snapshot_info
WHERE
domains.duuid = snapshot_info.duuid
group by name;
Returns
domain1 3
domain2 20
domain3 17
So, as you can see, the problem are introduceed when I add the users_domains join.
Any suggestions?