ERROR: synatx error at or near "group" - Mailing list pgsql-novice

From Dimitri
Subject ERROR: synatx error at or near "group"
Date
Msg-id AANLkTimNp2-8e75D11P+k2U=c9UtzBRX2D9nE1ra_Nwf@mail.gmail.com
Whole thread Raw
Responses Re: ERROR: synatx error at or near "group"  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
This query was working fine until I added another set of nested conditions... I've added three (3) asterisks (*) in front of each bit that I added before this error appeared, these are not in the actual query:

/* Query to pull non-SDS scans where alerts are not configured properly */
select site_name, site_alerts.site_id, alert_key, *** alert_value from alert_settings as als
JOIN alerts a on als.alert_id = a.alert_id
JOIN site_alerts sa on als.alert_id = sa.alert_id
JOIN alert_conds ac on als.alert_id = ac.alert_id
JOIN sites s on sa.site_id = s.site_id
where ((alert_key = 'recipient' and alert_setting not ilike 'TMSISS%')
OR (alert_key = 'server' and alert_setting not ilike 'smtp-relay.sct.com:25')
OR (alert_key = 'sender' and alert_setting not ilike 'r7@sungardhe.com')
OR (alert_key = 'verbose' and alert_setting not ilike '1')
*** OR (alert_cond = 'scan-status' and ((alert_value not ilike 'i') or (alert_value not ilike 's') or (alert_value not ilike 'e') or (alert_value not ilike 'p') or (alert_value not ilike 'r'))
*** OR (alert_cond = 'vuln-severity' and alert_value not ilike '1'))
AND alert_name not ilike 'SDS%'
group by sa.site_id, site_name, alert_key
order by site_name;

This returns ERROR: synatx error at or near "group" when I run it in the Query window in PGAdmin3

pgsql-novice by date:

Previous
From: Dimitri
Date:
Subject: Return only unique id's that are not associated with value
Next
From: Tom Lane
Date:
Subject: Re: ERROR: synatx error at or near "group"