pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Brice Ruth <brice@webprojkt.com>
To: Peter Eisentraut <peter_e@gmx.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: SQL Join - MySQL/PostgreSQL difference?
Date: Tue, 06 Feb 2001 09:57:53 -0600
Message-ID: <3A801F01.E0A4318E@webprojkt.com> (raw)
References: <Pine.LNX.4.30.0102060108580.762-100000@peter.localdomain>

Here's some more details:

The following query:

SELECT * FROM tblpemdruglink WHERE drugid = 'DG-5039';

returns the following results:

 drugid  | monographid
---------+-------------
 DG-5039 | 2008
(1 row)

the following query:

SELECT * FROM tblfdbmono WHERE
  monographid='2008' AND
  versionid='FDB-PE' AND
  category='PEM';

returns the following results:

 versionid | category | monographid | sequencenumber | sectioncode |    
                         linetext
-----------+----------+-------------+----------------+-------------+---------------------------------------------------------------------
{content}

sorry, the {content} is what's under NDA :(

In any case, you can see the structure of the tables tblpemdruglink and
tblfdbmono from here.

Now the following query:

SELECT sequencenumber,sectioncode,linetext
  FROM tblfdbmono fdb, tblpemdruglink pem WHERE
   fdb.monographid=pem.monographid AND
   fdb.versionid='FDB-PE' AND
   fdb.category='PEM' AND
   pem.drugid='DG-5039';

Should return the same results as the second query above.  However, this
is what I get:

 sequencenumber | sectioncode | linetext
----------------+-------------+----------
(0 rows)

And it takes about 3-4 seconds to return with that prognosis.  What's
going on here?

-Brice

Peter Eisentraut wrote:
> 
> Brice Ruth writes:
> 
> > SELECT
> >   a.Number,
> >   a.Code,
> >   a.Text
> > FROM
> >   b,
> >   a
> > WHERE
> >   (b.Id = a.Id) AND
> >   (VersionId = 'key1') AND
> >   (Category = 'key2') AND
> >   (b.d_Id = 'key3')
> > ORDER BY
> >   a.Number;
> >
> > (my apologies: I had to 'mangle' the table/column names because of NDA)
> >
> > So my question is this: would this query operate differently in MySQL
> > than in PostgreSQL? The reason I ask is that this query in MySQL
> > returns results, yet in PostgreSQL it does not.
> 
> Without showing the tables and the data in it, it's fairly hard to tell.
> I think MySQL does case insensitive string comparisons; check that.
> 
> > I read a post about PostgreSQL not supporting outer joins, but I don't
> > have enough experience with SQL to determine if this is such a query
> > or not.  Please advise.
> 
> This is not an outer join.
> 
> --
> Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/

-- 
Brice Ruth
WebProjkt, Inc.
VP, Director of Internet Technology
http://www.webprojkt.com/



view thread (29+ messages)  latest in thread

Message-ID: <3A801F01.E0A4318E@webprojkt.com>
Permalink:  ../3A801F01.E0A4318E@webprojkt.com/
Also on:    postgresql.org/message-id/3A801F01.E0A4318E@webprojkt.com

 · 

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: brice@webprojkt.com, peter_e@gmx.net
  Subject: Re: SQL Join - MySQL/PostgreSQL difference?
  In-Reply-To: <3A801F01.E0A4318E@webprojkt.com>
  References: <Pine.LNX.4.30.0102060108580.762-100000@peter.localdomain> <3A801F01.E0A4318E@webprojkt.com>

* 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