pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedCreate View
4+ messages / 4 participants
[nested] [flat]
* Create View
@ 2003-10-15 01:01 Muhyiddin A.M Hayat <middink@indo.net.id>
0 siblings, 1 reply; 4+ messages in thread
From: Muhyiddin A.M Hayat @ 2003-10-15 01:01 UTC (permalink / raw)
To: pgsql-sql
Dear all,
I Have This table
Table Billing:
id trx_date trx_time depart payment_method billing_amount amount_paid balance creator
1 10/09/2003 21:55:02 Resto Visa 13.800,00 10.000,00 3.800,00 middink
Table Payment
id r trx_date trx_time descriptions payment_method amount creator
1 10/08/2003 18:17:40 Payment Cash 2.000,00 middink
I would like to create "View " from above table with result look like:
trx_date trx_time descriptions payment_method debet credit balance creator
10/09/2003 21:55:02 Resto Billing 13.800,00 Paid: 10.000,00 Visa 3.800,00 3.800,00 middink
10/08/2003 18:17:40 Payment Cash 2.000,00 1.800,00 middink
How can I create View like above?
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Create View
@ 2003-10-15 08:17 Richard Huxton <dev@archonet.com>
parent: Muhyiddin A.M Hayat <middink@indo.net.id>
0 siblings, 0 replies; 4+ messages in thread
From: Richard Huxton @ 2003-10-15 08:17 UTC (permalink / raw)
To: Muhyiddin A.M Hayat <middink@indo.net.id>; pgsql-sql
On Wednesday 15 October 2003 02:01, Muhyiddin A.M Hayat wrote:
>
> Table Billing:
>
> id trx_date trx_time depart payment_method
> billing_amount amount_paid balance creator 1 10/09/2003
> 21:55:02 Resto Visa 13.800,00
> 10.000,00 3.800,00 middink
>
> Table Payment
>
> id r trx_date trx_time descriptions
> payment_method amount creator 1 10/08/2003 18:17:40
> Payment Cash 2.000,00 middink
>
>
> I would like to create "View " from above table with result look like:
>
>
> trx_date trx_time descriptions
> payment_method debet
> credit balance creator 10/09/2003 21:55:02 Resto
> Billing 13.800,00 Paid: 10.000,00 Visa
> 3.800,00 3.800,00 middink 10/08/2003
> 18:17:40 Payment
> Cash 2.000,00
> 1.800,00 middink
I'm not sure the above makes sense. I don't see any way to connect that
particular payment to that particular bill. You also seem to have two
different types of information in the billing table (billing *and* payment).
Also, the payment seems to be occurring before the bill - which can happen,
but there doesn't seem to be any account it is paid into.
Generally, there are two ways to do this:
1. Set-returning functions (see the manuals and
http://techdocs.postgresql.org)
2. A transaction/account page that you keep up to date in exactly the sort of
format you want in your view. Triggers can make sure this happens
automatically.
Unfortunately, if you're stuck with the tables you've shown us then I don't
think you can solve your problem.
--
Richard Huxton
Archonet Ltd
^ permalink raw reply [nested|flat] 4+ messages in thread
* Create View
@ 2006-11-05 06:17 Mark Simon <mark@manngo.net>
0 siblings, 1 reply; 4+ messages in thread
From: Mark Simon @ 2006-11-05 06:17 UTC (permalink / raw)
To: pgsql-sql
I don't know whether this is a simple one that has been dealt with
before, but if so, I haven't worked out the right question to search on.
If I create a view thus:
create view things as select * from whatever;
and then examine my saved view, I find a list of all of the fields from
whatever. I thought it should be possible to save the star (*) as part
of the view. Otherwise, I run into the problem of not getting all of the
fields if I add columns to the table (whatever).
Is this an SQL thing or a PostGreSQL thing?
Thanks,
Mark
--
Mark Simon
Manngo Net Pty Ltd
Phone/Fax: 1300 726 000
mobile: 0411 246 672
email: mark@manngo.net <mailto:mark@comparity.net>
web: http://www.manngo.net
Resume: http://mark.manngo.net
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Create View
@ 2006-11-05 07:38 Peter Eisentraut <peter_e@gmx.net>
parent: Mark Simon <mark@manngo.net>
0 siblings, 0 replies; 4+ messages in thread
From: Peter Eisentraut @ 2006-11-05 07:38 UTC (permalink / raw)
To: pgsql-sql; +Cc: Mark Simon <mark@manngo.net>
Mark Simon wrote:
> create view things as select * from whatever;
>
> and then examine my saved view, I find a list of all of the fields
> from whatever. I thought it should be possible to save the star (*)
> as part of the view. Otherwise, I run into the problem of not getting
> all of the fields if I add columns to the table (whatever).
>
> Is this an SQL thing or a PostGreSQL thing?
SQL
--
Peter Eisentraut
http://developer.postgresql.org/~petere/
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2006-11-05 07:38 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-10-15 01:01 Create View Muhyiddin A.M Hayat <middink@indo.net.id>
2003-10-15 08:17 ` Richard Huxton <dev@archonet.com>
2006-11-05 06:17 Create View Mark Simon <mark@manngo.net>
2006-11-05 07:38 ` Peter Eisentraut <peter_e@gmx.net>
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