pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedDivision
2+ messages / 2 participants
[nested] [flat]
* Division
@ 2000-09-18 22:47 Bernie Huang <bernie.huang@ec.gc.ca>
0 siblings, 1 reply; 2+ messages in thread
From: Bernie Huang @ 2000-09-18 22:47 UTC (permalink / raw)
To: pgsql-sql
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
Attachments:
bernie.huang.vcf (text/x-vcard, 314B) download
begin:vcard
n:Huang;Bernie
tel;fax:(604)664-9195
tel;work:(604)664-9172
x-mozilla-html:TRUE
org:Environment Canada;Standards and Technology Services
adr:;;700-1200 West 73 Ave.;Vancouver;BC;V6P 6H9;Canada
version:2.1
email;internet:bernie.huang@ec.gc.ca
title:Programmer
x-mozilla-cpt:;0
fn:Bernie Huang
end:vcard
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Division
@ 2000-09-18 23:24 Jie Liang <jliang@ipinc.com>
parent: Bernie Huang <bernie.huang@ec.gc.ca>
0 siblings, 0 replies; 2+ messages in thread
From: Jie Liang @ 2000-09-18 23:24 UTC (permalink / raw)
To: Bernie Huang <bernie.huang@ec.gc.ca>; +Cc: 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@ipinc.com
www.ipinc.com
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2000-09-18 23:24 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-09-18 22:47 Division Bernie Huang <bernie.huang@ec.gc.ca>
2000-09-18 23:24 ` Jie Liang <jliang@ipinc.com>
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