Du kan ikke gøre dette WHERE inc_amount=max(inc_amount)
i where-sætningen skal du enten bruge HAVING
eller gør det i betingelsen af at deltage, prøv dette i stedet:
SELECT
e.emp_id,
e.inc_date,
t.TotalInc,
t.MaxIncAmount
FROM salary_increase AS i
INNER JOIN emp_table AS e ON i.emp_id=e.emp_id
INNER JOIN
(
SELECT
emp_id,
MAX(inc_amount) AS MaxIncAmount,
COUNT(i.inc_amount) AS TotalInc
FROM salary_increase
GROUP BY emp_id
) AS t ON e.emp_id = t.emp_id AND e.inc_amount = t.MaxIncAmount;