pg.ddx.io pgsql-sql@postgresql.org mailing list archivehelp / color / mirror / Atom feed
(no subject) 2+ messages / 2 participants [nested] [flat]
* (no subject) @ 2003-11-08 06:52 ronald@my.msuiit.edu.ph 2003-11-10 17:17 ` Re: Louise Cofield <lcofield@box-works.com> 0 siblings, 1 reply; 2+ messages in thread From: ronald@my.msuiit.edu.ph @ 2003-11-08 06:52 UTC (permalink / raw) To: pgsql-sql Hello everyone, Good day! Could anyone help me translate this query in Microsoft Access to Postgresql. I'm having a difficulty. Pls... Query1: SELECT items.description, Sum(supplieditems.qty) AS SumOfqty FROM items INNER JOIN supplieditems ON items.itemno = supplieditems.itemno GROUP BY items.description; Query2: SELECT [items].[description], Sum([customer].[qty]) AS SumOfqty FROM (items INNER JOIN OtherItem ON [items].[itemno]=[OtherItem].[Itemno]) INNER JOIN customer ON [OtherItem].[Itemno]=[customer].[itemcode] GROUP BY [items].[description]; Query3: SELECT [Query1].[SumOfqty], [Query2].[SumOfqty], [Query1]![SumOfqty]-[Query2]![SumOfqty] AS remain FROM Query1, Query2; I have translated Query1 and Query2 in POSTGRESQL but I don't know how to implement Query3. ____________________________________________________________ Are you a student of MSU-IIT? Log on http://my.msuiit.edu.ph and sign up for your My.MSUIIT E-mail Plus account now! Are you an MSU-IIT alumnus? Log on http://www.alumni.msuiit.edu.ph ^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: 2003-11-08 06:52 (no subject) ronald@my.msuiit.edu.ph @ 2003-11-10 17:17 ` Louise Cofield <lcofield@box-works.com> 0 siblings, 0 replies; 2+ messages in thread From: Louise Cofield @ 2003-11-10 17:17 UTC (permalink / raw) To: ronald@my.msuiit.edu.ph; pgsql-sql You will have to use a WHERE clause or a JOIN in query three, so you will have to include some field, such as itemno, in the result sets of both query1 and query2 on which you can join with where or join. Such as: Select query1.sumofqty as sum1, query2.sumofqty as sum2, query1.sumofqty - query2.sumofqty as remain from query1, query2 where query1.<itemno> = query2.<itemno> -----Original Message----- From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of ronald@my.msuiit.edu.ph Sent: Friday, November 07, 2003 11:52 PM To: pgsql-sql@postgresql.org Subject: [SQL] Hello everyone, Good day! Could anyone help me translate this query in Microsoft Access to Postgresql. I'm having a difficulty. Pls... Query1: SELECT items.description, Sum(supplieditems.qty) AS SumOfqty FROM items INNER JOIN supplieditems ON items.itemno = supplieditems.itemno GROUP BY items.description; Query2: SELECT [items].[description], Sum([customer].[qty]) AS SumOfqty FROM (items INNER JOIN OtherItem ON [items].[itemno]=[OtherItem].[Itemno]) INNER JOIN customer ON [OtherItem].[Itemno]=[customer].[itemcode] GROUP BY [items].[description]; Query3: SELECT [Query1].[SumOfqty], [Query2].[SumOfqty], [Query1]![SumOfqty]-[Query2]![SumOfqty] AS remain FROM Query1, Query2; I have translated Query1 and Query2 in POSTGRESQL but I don't know how to implement Query3. ____________________________________________________________ Are you a student of MSU-IIT? Log on http://my.msuiit.edu.ph and sign up for your My.MSUIIT E-mail Plus account now! Are you an MSU-IIT alumnus? Log on http://www.alumni.msuiit.edu.ph ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2003-11-10 17:17 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2003-11-08 06:52 ronald@my.msuiit.edu.ph 2003-11-10 17:17 ` Re: Louise Cofield <lcofield@box-works.com>
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