From middink@indo.net.id Wed Oct 15 00:51:49 2003 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id C5AC1D1B515 for ; Wed, 15 Oct 2003 00:51:49 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 27708-07 for ; Tue, 14 Oct 2003 21:51:22 -0300 (ADT) Received: from smtp-1.indo.net.id (smtp-1.indo.net.id [202.159.32.91]) by svr1.postgresql.org (Postfix) with SMTP id 539E9D1B4FC for ; Tue, 14 Oct 2003 21:51:15 -0300 (ADT) Received: (qmail 11010 invoked from network); 15 Oct 2003 07:51:00 +0700 Received: from smtp.indo.net.id (202.159.32.81) by smtp-1.indo.net.id with SMTP; 15 Oct 2003 07:51:00 +0700 Received: (qmail 3918 invoked from network); 15 Oct 2003 00:48:36 -0000 Received: from unknown (HELO pop.makassar.indo.net.id) (202.159.23.19) by smtp.indo.net.id with SMTP; 15 Oct 2003 00:48:36 -0000 Received: FROM middinkcomp BY pop.makassar.indo.net.id ; Wed Oct 15 08:59:53 2003 +0700 Message-ID: <009401c392b7$e5fefe30$1f00a8c0@middinkcomp> From: "Muhyiddin A.M Hayat" To: Subject: Create View Date: Wed, 15 Oct 2003 09:01:42 +0800 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0091_01C392FA.F39344A0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=HTML_60_70 X-Spam-Level: X-Archive-Number: 200310/166 X-Sequence-Number: 15566 This is a multi-part message in MIME format. ------=_NextPart_000_0091_01C392FA.F39344A0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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_metho= d 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 cre= dit 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? ------=_NextPart_000_0091_01C392FA.F39344A0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Dear all,
 
I Have This table
 
 
Table Billing:
 
       = =20 id      =20 trx_date       trx_time   = ;  depart       payment_method=    =20 billing_amount    amount_paid    =20 balance       creator
  &nb= sp;     =20 1      10/09/2003 =20 21:55:02   Resto       = =20 Visa            = ;            &n= bsp;  13.800,00        &n= bsp;       =20 10.000,00      =20 3.800,00       middink
Table Payment
 
       = id=20 r   trx_date       =20 trx_time        descriptions &= nbsp;=20 payment_method   amount     =20 creator
        =20 1     10/08/2003  18:17:40  &n= bsp;   Payment       &nbs= p;  Cash         &nb= sp;            =    2.000,00     middink
 
 
I would like to create "View " from above = table=20 with result look like:
 
 
       =  =20 trx_date       trx_time   = ;  descriptions=20             &nb= sp;            =  =20             &nb= sp;            =        =20 payment_method   debet      &n= bsp;        credit   = ;          balance &= nbsp;       creator
        =20 10/09/2003 =20 21:55:02   Resto  Billing  13.800,00 Pai= d:=20 10.000,00         Visa &n= bsp;            = ;            3.= 800,00           &nb= sp;            =        3.800,00    &= nbsp;    middink
        =20 10/08/2003  18:17:40    Payment  &n= bsp;            = ;            &n= bsp;            = ;            &n= bsp;            = ;=20 Cash            = ;            &n= bsp;  =20                = =20    =20 2.000,00       1.800,00   = ;      =20 middink
 
 
How can I create View like above?
------=_NextPart_000_0091_01C392FA.F39344A0-- From dev@archonet.com Wed Oct 15 08:18:27 2003 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 81028D1B4F2 for ; Wed, 15 Oct 2003 08:18:27 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 07600-01 for ; Wed, 15 Oct 2003 05:17:58 -0300 (ADT) Received: from anchor-post-35.mail.demon.net (anchor-post-35.mail.demon.net [194.217.242.85]) by svr1.postgresql.org (Postfix) with ESMTP id 41393D1B508 for ; Wed, 15 Oct 2003 05:17:56 -0300 (ADT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-35.mail.demon.net with esmtp (Exim 3.35 #1) id 1A9gqy-000KZf-0Z; Wed, 15 Oct 2003 09:17:56 +0100 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id EA38B161EF; Wed, 15 Oct 2003 09:17:51 +0100 (BST) Received: from client17.archonet.com (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 553B515D92; Wed, 15 Oct 2003 09:17:51 +0100 (BST) From: Richard Huxton To: "Muhyiddin A.M Hayat" , Subject: Re: Create View Date: Wed, 15 Oct 2003 09:17:50 +0100 User-Agent: KMail/1.5 References: <009401c392b7$e5fefe30$1f00a8c0@middinkcomp> In-Reply-To: <009401c392b7$e5fefe30$1f00a8c0@middinkcomp> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200310150917.50227.dev@archonet.com> X-Virus-Scanned: by AMaViS snapshot-20020531 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/172 X-Sequence-Number: 15572 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 From mark@manngo.net Sun Nov 5 06:34:29 2006 Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 650419F931B for ; Sun, 5 Nov 2006 02:34:29 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 03665-09 for ; Sun, 5 Nov 2006 06:34:24 +0000 (UTC) X-Greylist: delayed 00:16:56.023834 by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 95AE99F9F0A for ; Sun, 5 Nov 2006 02:34:24 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from localhost.localdomain (unknown [58.105.225.59]) by svr4.postgresql.org (Postfix) with ESMTP id 1EADC5AF04F for ; Sun, 5 Nov 2006 06:17:26 +0000 (GMT) Received: from [127.0.0.1] ([192.168.1.5]) by localhost.localdomain (8.13.1/8.12.11) with ESMTP id kA56HEiq013003 for ; Sun, 5 Nov 2006 17:17:21 +1100 Message-ID: <454D81EB.1010003@manngo.net> Date: Sun, 05 Nov 2006 17:17:15 +1100 From: Mark Simon User-Agent: Thunderbird 1.5.0.7 (Windows/20060909) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Create View Content-Type: multipart/alternative; boundary="------------070502040409000809010902" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.085 tagged_above=0 required=5 tests=BAYES_40, FORGED_RCVD_HELO, HTML_50_60, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200611/51 X-Sequence-Number: 26703 This is a multi-part message in MIME format. --------------070502040409000809010902 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 web: http://www.manngo.net Resume: http://mark.manngo.net --------------070502040409000809010902 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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
web: http://www.manngo.net

Resume: http://mark.manngo.net

--------------070502040409000809010902-- From peter_e@gmx.net Sun Nov 5 07:39:02 2006 Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 655C79FA0EE for ; Sun, 5 Nov 2006 03:39:02 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 47255-06 for ; Sun, 5 Nov 2006 03:39:02 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from mail.gmx.net (mail.gmx.de [213.165.64.20]) by postgresql.org (Postfix) with SMTP id 5A5C59F9EF0 for ; Sun, 5 Nov 2006 03:39:00 -0400 (AST) Received: (qmail invoked by alias); 05 Nov 2006 07:38:58 -0000 Received: from dslb-084-063-034-223.pools.arcor-ip.net (EHLO colt.pezone.net) [84.63.34.223] by mail.gmx.net (mp035) with SMTP; 05 Nov 2006 08:38:58 +0100 X-Authenticated: #495269 From: Peter Eisentraut To: pgsql-sql@postgresql.org Subject: Re: Create View Date: Sun, 5 Nov 2006 08:38:56 +0100 User-Agent: KMail/1.9.5 Cc: Mark Simon References: <454D81EB.1010003@manngo.net> In-Reply-To: <454D81EB.1010003@manngo.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200611050838.56984.peter_e@gmx.net> X-Y-GMX-Trusted: 0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/53 X-Sequence-Number: 26705 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/