What I\'m trying to do is have it where I get the occurances on an id in the table, and then based upon the amount of occurances, divide the value of another column by that valu
Just throw it in a sub-query and do the math after that:
SELECT t_id, occurances, value/occurances AS newValue
from (
SELECT t.t_id, count(DISTINCT tm.tm_id) AS occurances, t.value
FROM table t
INNER JOIN table_map tm ON t.t_id = tm.tm_id
GROUP BY t.t_id
HAVING occurances > 1) t
Maybe you meant something like this:
SELECT
t.t_id,
t.occurrences,
t.value / tm.occurrences AS newValue
FROM table t
INNER JOIN (
SELECT
tm_id,
COUNT(*) AS occurrences
FROM table_map
GROUP BY tm_id
HAVING COUNT(*) > 1
) tm ON t.t_id = tm.tm_id