Re: LIMIT within UNION?
От | Roland Roberts |
---|---|
Тема | Re: LIMIT within UNION? |
Дата | |
Msg-id | m27khrovbh.fsf@kuiper.rlent.pnet обсуждение исходный текст |
Ответ на | LIMIT within UNION? (Andrew Perrin <clists@perrin.socsci.unc.edu>) |
Ответы |
Re: LIMIT within UNION?
|
Список | pgsql-sql |
>>>>> "Andrew" == Andrew Perrin <clists@perrin.socsci.unc.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 problemstarts. [...] 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@rlenter.com 76-15 113th Street, Apt 3B roland@astrofoto.org Forest Hills, NY 11375
В списке pgsql-sql по дате отправления: