pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Niklas Johansson <spot@tele2.se>
To: Jonathan Sinclair <jonathan.sinclair@molevalleyfarmers.com>
Cc: pgsql-sql@postgresql.org
Subject: Re:
Date: Fri, 11 Aug 2006 01:30:45 +0200
Message-ID: <7D3E0D83-0581-43CF-A767-91F184203064@tele2.se> (raw)
In-Reply-To: <746457F7E51F3B4BB53A8447D7204B78E44F@MVGMAIL.mvg.local>
References: <746457F7E51F3B4BB53A8447D7204B78E44F@MVGMAIL.mvg.local>


On 4 aug 2006, at 08.55, Jonathan Sinclair wrote:
> SELECT field1, SUM(field2) as Field2, SUM(field3)
> FROM table1 tb1, table2 tb2
> WHERE tb1.field5 BETWEEN '03/07/2006' AND '03/08/2006'
> AND tb1.field6 = tb2.field7
> AND tb1.field8 = tb2.field8
> AND tb2.field9 BETWEEN 50.00 AND 150.00
> GROUP BY field1
> HAVING SUM(field2) BETWEEN 95.00 AND 100.00
> ORDER BY 2 DESC, field1;
>
> The results I get from Informix and mySql return identical results,
> however postgres includes a great deal more i.e. 11 rows from Informix
> and mySQL, 203 from postgres.
>
> Does anyone have any idea why this disparity may exist?

An obvious source of ambiguity is the date comparison:

tb1.field5 BETWEEN '03/07/2006' AND '03/08/2006'

Is that interval a day or a month (mm/dd/yyyy or dd/mm/yyyy)? Check  
your datestyle setting and make sure all systems interpret the date  
correctly (or at least the same).


Sincerely,

Niklas Johansson







view thread (2+ messages)

Message-ID: <7D3E0D83-0581-43CF-A767-91F184203064@tele2.se>
Permalink:  ../7D3E0D83-0581-43CF-A767-91F184203064@tele2.se/
Also on:    postgresql.org/message-id/7D3E0D83-0581-43CF-A767-91F184203064@tele2.se

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: spot@tele2.se, jonathan.sinclair@molevalleyfarmers.com
  Subject: Re: 
  In-Reply-To: <7D3E0D83-0581-43CF-A767-91F184203064@tele2.se>
  References: <746457F7E51F3B4BB53A8447D7204B78E44F@MVGMAIL.mvg.local> <7D3E0D83-0581-43CF-A767-91F184203064@tele2.se>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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