pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jie Liang <jliang@ipinc.com>
To: Bernie Huang <bernie.huang@ec.gc.ca>
Cc: PGSQL-SQL <pgsql-sql@postgresql.org>
Subject: Re: Division
Date: Mon, 18 Sep 2000 16:24:59 -0700
Message-ID: <39C6A44A.3B58CAB1@ipinc.com> (raw)
References: <39C69B97.58B353A9@ec.gc.ca>

Hi, there,

I don't quit sure what you really want to solve, however,
if you use EXCEPT results1 and result2 should be same type rather than
tables, i.e.
select a,b from tab1
except
select c,d from tab2;

a,c are same type
b,d are same type.

notes, EXCEPT to big table is not efficient, so does IN clause.

Bernie Huang wrote:

> Hi,
>
> I tried the write up the following SQL statement:
>
> result1 from sql1 = (1,2,3,4,5)
> result2 from sql2 = (4,5)
> result3 = result1/result2 (or is it result2/result1) = (1,2,3)
>
> What do I have to do to get the (1,2,3) result?  I tried "query EXCEPT
> query", but it seems like EXCEPT needs both tables in queries to be of
> the same number of columns and column types.  And (any, all, exist)
> doesn't seem to be a right solution.
>
> Thanks for help.
>
> - Bernie

--
Jie LIANG

Internet Products Inc.

10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873

jliang@ipinc.com
www.ipinc.com






view thread (2+ messages)

Message-ID: <39C6A44A.3B58CAB1@ipinc.com>
Permalink:  ../39C6A44A.3B58CAB1@ipinc.com/
Also on:    postgresql.org/message-id/39C6A44A.3B58CAB1@ipinc.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: jliang@ipinc.com, bernie.huang@ec.gc.ca
  Subject: Re: Division
  In-Reply-To: <39C6A44A.3B58CAB1@ipinc.com>
  References: <39C69B97.58B353A9@ec.gc.ca> <39C6A44A.3B58CAB1@ipinc.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