Re: ERROR: synatx error at or near "group"

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dimitri <a(dot)dmitri(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: ERROR: synatx error at or near "group"
Date: 2011-03-19 05:10:47
Message-ID: 1645.1300511447@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Dimitri <a(dot)dmitri(at)gmail(dot)com> writes:
> 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(at)sungardhe(dot)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

The parentheses aren't balanced any more.

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Roman Stasak 2011-03-19 06:37:40 Self i18n reguest - EN->SK(custom)
Previous Message Dimitri 2011-03-19 04:55:32 ERROR: synatx error at or near "group"