Re: LIMIT within UNION?
От | Andrew Perrin |
---|---|
Тема | Re: LIMIT within UNION? |
Дата | |
Msg-id | Pine.LNX.4.21.0209121540540.32000-100000@perrin.socsci.unc.edu обсуждение исходный текст |
Ответ на | Re: LIMIT within UNION? (Roland Roberts <roland@astrofoto.org>) |
Ответы |
Re: LIMIT within UNION?
|
Список | pgsql-sql |
On 12 Sep 2002, Roland Roberts wrote: > >>>>> "Andrew" == Andrew Perrin <clists@perrin.socsci.unc.edu> writes: > ... > 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; > Unfortunately in this case the LIMIT is applied to the fully-UNIONed set, limiting the total number of cases to 172 instead of just those from the second subquery. Tom Lane's example worked, though. Thanks, Andy ---------------------------------------------------------------------- Andrew J Perrin - http://www.unc.edu/~aperrin Assistant Professor of Sociology, U of North Carolina, Chapel Hill clists@perrin.socsci.unc.edu * andrew_perrin (at) unc.edu
В списке pgsql-sql по дате отправления: