Re: [GENERAL] Question about a query with two count fields

2007-09-11 Thread Tom Lane
Michael Glaesemann <[EMAIL PROTECTED]> writes: > What's ambigious about it? An operator cannot include a space, so != > (no space) is *always* interpreted as one operator: not equals (<>). Right. There are some corner cases though, for example A*-5 which you'd probably rather weren't

Re: [GENERAL] Question about a query with two count fields

2007-09-11 Thread Michael Glaesemann
On Sep 11, 2007, at 13:42 , David Fetter wrote: I believe that foo!=bar without white space should simply error out because there is no reasonable, unambiguous way to parse it. Here's what we get right now: What's ambigious about it? An operator cannot include a space, so != (no space) is

Re: [GENERAL] Question about a query with two count fields

2007-09-11 Thread David Fetter
On Tue, Sep 11, 2007 at 02:28:24PM -0400, Tom Lane wrote: > "George Pavlov" <[EMAIL PROTECTED]> writes: > >> From: David Fetter [mailto:[EMAIL PROTECTED] > >> This case statement returns true when z factorial is zero, so I'd > >> recommend the SQL standard <> or IS NOT DISTINCT FROM instead. > > >

Re: [GENERAL] Question about a query with two count fields

2007-09-11 Thread Tom Lane
"George Pavlov" <[EMAIL PROTECTED]> writes: >> From: David Fetter [mailto:[EMAIL PROTECTED] >> This case statement returns true when z factorial is zero, so I'd >> recommend the SQL standard <> or IS NOT DISTINCT FROM instead. > i do hate potential ambiguity... the != was something stuck in my bra

Re: [GENERAL] Question about a query with two count fields

2007-09-11 Thread George Pavlov
> From: David Fetter [mailto:[EMAIL PROTECTED] > On Tue, Sep 11, 2007 at 08:55:53AM -0700, George Pavlov wrote: > > sum(case when z!=0 then 1 end) as good, > > This case statement returns true when z factorial is zero, so I'd > recommend the SQL standard <> or IS NOT DISTINCT FROM instead. and

Re: [GENERAL] Question about a query with two count fields

2007-09-11 Thread Jeff Lanzarotta
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Jeff > Lanzarotta > Sent: Tuesday, September 11, 2007 8:51 AM > To: PostgreSQL GENERAL List > Subject: [GENERAL] Question about a query with two count fields > > Hello, > >

Re: [GENERAL] Question about a query with two count fields

2007-09-11 Thread Rodrigo De León
Remove the ", 0 AS ajaa", that was some filler that got thru by mistake. ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [GENERAL] Question about a query with two count fields

2007-09-11 Thread David Fetter
ssage- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On Behalf Of Jeff > > Lanzarotta > > Sent: Tuesday, September 11, 2007 8:51 AM > > To: PostgreSQL GENERAL List > > Subject: [GENERAL] Question about a query with two count fields > > &

Re: [GENERAL] Question about a query with two count fields

2007-09-11 Thread Rodrigo De León
On 9/11/07, Jeff Lanzarotta <[EMAIL PROTECTED]> wrote: > I appreciate the help... SELECT TO_CHAR(ts, 'MM/DD/') AS "day", str, proc , SUM(CASE WHEN z <> 0 THEN 1 ELSE 0 END) AS good, 0 AS ajaa , SUM(CASE

Re: [GENERAL] Question about a query with two count fields

2007-09-11 Thread George Pavlov
o:[EMAIL PROTECTED] On Behalf Of Jeff > Lanzarotta > Sent: Tuesday, September 11, 2007 8:51 AM > To: PostgreSQL GENERAL List > Subject: [GENERAL] Question about a query with two count fields > > Hello, > > I am in need of producing a query that has two count fields >

[GENERAL] Question about a query with two count fields

2007-09-11 Thread Jeff Lanzarotta
Hello, I am in need of producing a query that has two count fields in it... Something like: select to_char(ts, 'MM/DD/') as "day", str, proc, (select count (*) as good from foobar where z != 0), (select count (*) as bad from foobar where z = 0) from foobar where str != 9 group by str, da