Re: [SQL] complex query

2012-10-28 Thread Oliveiros d'Azevedo Cristina
know about your thoughts on this? Thanks in advance Best, Oliver - Original Message - From: "Scott Marlowe" To: "Mark Fenbers" Cc: Sent: Sunday, October 28, 2012 2:20 AM Subject: Re: [SQL] complex query On Sat, Oct 27, 2012 at 7:56 PM, Mark Fenbers wrote: I&#

Re: [SQL] complex query

2012-10-27 Thread Scott Marlowe
On Sat, Oct 27, 2012 at 7:56 PM, Mark Fenbers wrote: > I'd do somethings like: > > select * from ( > select id, sum(col1), sum(col2) from tablename group by yada >) as a [full, left, right, outer] join ( > select id, sum(col3), sum(col4) from tablename group by bada > ) as b > on (

Re: [SQL] complex query

2012-10-27 Thread Mark Fenbers
I'd do somethings like: select * from ( select id, sum(col1), sum(col2) from tablename group by yada ) as a [full, left, right, outer] join ( select id, sum(col3), sum(col4) from tablename group by bada ) as b on (a.id=b.id); and choose the join type as appropria

Re: [SQL] complex query

2012-10-27 Thread Scott Marlowe
On Sat, Oct 27, 2012 at 6:01 PM, Mark Fenbers wrote: > I have a query: > SELECT id, SUM(col1), SUM(col2) FROM mytable WHERE condition1 = true GROUP > BY id; > > This gives me 3 columns, but what I want is 5 columns where the next two > columns -- SUM(col3), SUM(col4) -- have a slightly different W

[SQL] complex query

2012-10-27 Thread Mark Fenbers
I have a query: SELECT id, SUM(col1), SUM(col2) FROM mytable WHERE condition1 = true GROUP BY id; This gives me 3 columns, but what I want is 5 columns where the next two columns -- SUM(col3), SUM(col4) -- have a slightly different WHERE clause, i.e., WHERE condi

Re: [SQL] Complex Query - Data from 3 tables simultaneously

2005-10-28 Thread Amit_Wadhwa
x27; ") 23:59:59' as datetime) Did the above, got the expected results, did not specify 'Outer Join' only specified Join, is that a problem?   From: Muralidharan Ramakrishnan [mailto:[EMAIL PROTECTED] Sent: Friday, October 28, 2005 10:41 PMTo: Wadhwa, Amit; pgsql-sql@postgr

Re: [SQL] Complex Query - Data from 3 tables simultaneously

2005-10-28 Thread Muralidharan Ramakrishnan
SELECT A.SID , A.RECDATE , B.MID , B.MBDATE , C.ISSDATE FROM TableA A LEFT OUTER JOIN TableB B ON   A.SID = B.SIDLEFT OUTER JOIN TableC C ON B.MID = C.MIDORDER BY A.SID[EMAIL PROTECTED] wrote: All,   Using Postgres 8.0 on Windows Server 2003 - 16GB Ram, 3Ghz X 2 Xeons Accessing through JDBC / J

Re: [SQL] Complex Query - Data from 3 tables simultaneously

2005-10-27 Thread Amit_Wadhwa
Thanks a lot, that worked for me! -Original Message- From: Richard Huxton [mailto:[EMAIL PROTECTED] Sent: Thursday, October 27, 2005 2:47 PM To: Wadhwa, Amit Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] Complex Query - Data from 3 tables simultaneously [EMAIL PROTECTED] wrote

Re: [SQL] Complex Query - Data from 3 tables simultaneously

2005-10-27 Thread Richard Huxton
[EMAIL PROTECTED] wrote: Basically I want a raw dump of data - Should have all the shipments regardless of whether they have any material items entered or not - Should have all Material Items for Every Shipment regardless of whether it was issued or not. I know I need an outer join (Do I Not?

[SQL] Complex Query - Data from 3 tables simultaneously

2005-10-27 Thread Amit_Wadhwa
All,   Using Postgres 8.0 on Windows Server 2003 - 16GB Ram, 3Ghz X 2 Xeons Accessing through JDBC / JSP   I have 3 shipment tables. Table A - Records arrived Shipments. Table B - Records Materials (maybe more than one per shipment) in the shipment. Table C - Records Issuances of material (

[SQL] complex query

2003-03-03 Thread Matt Gerginski
I have two tables, users and options. The common element between the tables is "username". I want to select the "email" from "user" but only if the "mailing_list" option is set to true in the "options" table. Here are the tables: select username, email from users; username| e

[SQL] Complex Query Help

2001-03-21 Thread Brian C. Doyle
Hello all, I have a table of work shifts. It has Table "teams" Attribute | Type | Modifier +---+-- team_id| varchar(50) | team_name | varchar(100) | location | varchar(100) | department | varchar(100) | shift |

[SQL] Complex query

2000-08-27 Thread J. Fernando Moyano
Hey everybody !!! I am new on this list !!! I have a little problem . I try this on my system: "select n_lote from pedidos except select rp.n_lote from relpedidos rp, relfacturas rf where rp.n_lote=rf.n_lote group by rp.n_lote having sum(rp.cantidad)=sum(rf.cantidad)" I get this result: