i have two tables Incident (id, date) Reminder (incidentID, type) inner join on incident.id = reminder.incidentID
and i want to take incident.id only if it has more than 4 reminder.type = 15 what i think is
SELECT incident.id
FROM incident
INNER JOIN reminder ON incident.id = reminder.incidentid
HAVING COUNT (reminder.remindertype = "something") >5
GROUP BY incident.incidentcode
The erroe i get is
Line 6: Incorrect syntax near '='.
What can i do?
COUNT
doesn't work like that.
Try:
select incident.id
from incident
inner join reminder
on incident.id = reminder.incidentid
WHERE reminder.remindertype = "something"
group by incident.incidentcode
having count (reminder.remindertype) >5
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With