From: | Roland Roberts <roland(at)astrofoto(dot)org> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: LIMIT within UNION? |
Date: | 2002-09-12 19:35:14 |
Message-ID: | m27khrovbh.fsf@kuiper.rlent.pnet |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
>>>>> "Andrew" == Andrew Perrin <clists(at)perrin(dot)socsci(dot)unc(dot)edu> writes:
Andrew> What I've done is to write a script that counts the number
Andrew> of eligible exposure candidates:
Andrew> SELECT count(*) FROM participants WHERE <eligibility>
Andrew> AND typenr=1
Andrew> Then subtract that number (currently 28) from 200 to get
Andrew> 172 control participants. Then the problem starts.
[...]
Andrew> returns ERROR: parser: parse error at or near "ORDER"
Can you do this via a subselect:
SELECT * FROM
( SELECT ... FROM participants
WHERE typenr=1 AND <eligibility>
UNION
SELECT ... FROM participants
WHERE typenr=2 LIMIT 172 )
ORDER BY zip;
roland
--
PGP Key ID: 66 BC 3B CD
Roland B. Roberts, PhD RL Enterprises
roland(at)rlenter(dot)com 76-15 113th Street, Apt 3B
roland(at)astrofoto(dot)org Forest Hills, NY 11375
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Perrin | 2002-09-12 19:40:46 | Re: LIMIT within UNION? |
Previous Message | Tom Lane | 2002-09-12 19:34:07 | Re: LIMIT within UNION? |