On Tue, 15 Jul 2025, Laurenz Albe wrote:
Apart from that, the subquery seems to be missing a GROUP BY clause.
Laurenz,
That was added.
Thanks,
Rich
On Monday, July 14, 2025, Laurenz Albe wrote:
> On Mon, 2025-07-14 at 12:19 -0700, Rich Shepard wrote:
> > On Mon, 14 Jul 2025, David G. Johnston wrote:
> >
> > > The error indicates your script file is at least 127 lines long and you
> > > are showing like 9...also do you usually name your scrip
On Mon, 2025-07-14 at 12:19 -0700, Rich Shepard wrote:
> On Mon, 14 Jul 2025, David G. Johnston wrote:
>
> > 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?
>
> Agh! No the filen
On Mon, 14 Jul 2025, David G. Johnston wrote:
Yeah, you need both to read up on aggregate queries and correlated
subqueries which is typically how one makes uses of exists (it's called a
semi-join in this formulation)
David,
Thanks. I wasn't sure what to read.
Not tested, but:
select c.ind
On Mon, Jul 14, 2025 at 12:59 PM Rich Shepard
wrote:
>
> The current version of the script:
>
> select c.company_nbr, c.company_name, c.industry
> from companies as c
> where exists (
>select e.company_nbr
>from enforcement as e
>)
> group by c.industry
> order by c.industry;
>
> And
On Mon, 14 Jul 2025, Adrian Klaver wrote:
That does not matter, that is more for user convenience in figuring out what
the files are for.
Adrian,
Okay.
I still have issues with the script. I want a count of companies with
regulatory enforcement actions by industry. Since not all regulated
co
On Mon, Jul 14, 2025 at 12:45 PM Adrian Klaver
wrote:
> >
> > I mistyped the script's extension as .txt rather than .sql.
>
> That does not matter, that is more for user convenience in figuring out
> what the files are for.
>
>
I think all that is being said is the error was a simple typo, choosi
On 7/14/25 12:38, Rich Shepard wrote:
Reply to list also.
Ccing list.
On Mon, 14 Jul 2025, Adrian Klaver wrote:
The above looks like the format 'aligned' output from a query.
Adrian,
I mistyped the script's extension as .txt rather than .sql.
That does not matter, that is more for user c
On 7/14/25 12:12, Rich Shepard 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_nb
On Mon, 14 Jul 2025, David G. Johnston wrote:
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.,
Agh! No the filename extension is .sql. But I was using the \o psql option
to
On Mon, Jul 14, 2025 at 12:12 PM Rich Shepard
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.enforce
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
or
12 matches
Mail list logo