From: | Jie Liang <jliang(at)ipinc(dot)com> |
---|---|
To: | Bernie Huang <bernie(dot)huang(at)ec(dot)gc(dot)ca> |
Cc: | PGSQL-SQL <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Division |
Date: | 2000-09-18 23:24:59 |
Message-ID: | 39C6A44A.3B58CAB1@ipinc.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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(at)ipinc(dot)com
www.ipinc.com
From | Date | Subject | |
---|---|---|---|
Next Message | Louis-David Mitterrand | 2000-09-19 10:58:59 | sum of agreggates in one SELECT? |
Previous Message | Bernie Huang | 2000-09-18 22:47:51 | Division |