Re: Syntax error needs explanation

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Syntax error needs explanation
Date: 2025-07-14 19:14:47
Message-ID: CAKFQuwZ2vqO68y6A64R0VYpsw=uhh1ZaVd-bxeswHRsw2YTnkg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Jul 14, 2025 at 12:12 PM Rich Shepard <rshepard(at)appl-ecosys(dot)com>
wrote:

> I have the following script:
>
> select c.company_nbr, c.company_name, i.industry,
> from companies as c, industry as i, enforcement as e
> where exists (
> select c.company_nbr, count(e.action_date), sum(e.penalty_amt)
> from e.enforcement
> where c.company_nbr = e.company_nbr
> )
> group by industry
> order by industry;
>
> When I run it psql reports an error:
> psql:companies-with-enforcement-actions.txt:127: ERROR: syntax error at
> or near "company_nbr"
> LINE 1: company_nbr | company_name
> ^
> and I'm not seeing the error. What am I missing?
>

The error indicates your script file is at least 127 lines long and you are
showing like 9...also do you usually name your script files with a .txt
extension?

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2025-07-14 19:19:44 Re: Syntax error needs explanation [RESOLVED]
Previous Message Rich Shepard 2025-07-14 19:12:07 Syntax error needs explanation