From: Robert Zenz <robert.zenz@sibvisions.com>
To: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: Ways to deal with large amount of columns;
Date: Thu, 30 Aug 2018 13:15:07 +0000
Message-ID: <5B87EDDF.60602@sibvisions.com> (raw)
In-Reply-To: <tencent_74B211A80785C27C5C3C58D8@qq.com>
References: <tencent_74B211A80785C27C5C3C58D8@qq.com>
As David said, you'd be better off having a table that looks like this (in terms
of columns):
* MONTH
* AGENT
* CASHFLOW
So your query to get the sum of a single agent would be looking like:
select
sum(CHASFLOW)
where
AGENT = 'Agent'
and MONTH between values;
It might be a little more work to create a GUI for that (or map this model to
the existing GUI) but it is much simpler to maintain and work with.
On 30.08.2018 11:13, a wrote:
> Hi all:
>
>
> I need to make a table contains projected monthly cashflow for multiple agents (10,000 around).
>
>
> Therefore, the column number would be 1000+.
>
>
> I would need to perform simple aggregate function such as count, sum or average on each cashflow projected.
>
>
> So if there is anyway of doing this? Will there be anything like define a macro in C that I can manipulate multiple columns by simple word that representing them.
>
>
> Thanks so much!
>
>
> Shore
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: robert.zenz@sibvisions.com
Subject: Re: Ways to deal with large amount of columns;
In-Reply-To: <5B87EDDF.60602@sibvisions.com>
References: <tencent_74B211A80785C27C5C3C58D8@qq.com> <5B87EDDF.60602@sibvisions.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox