Re: ranked subqueries vs distinct question
От | Karsten Hilbert |
---|---|
Тема | Re: ranked subqueries vs distinct question |
Дата | |
Msg-id | 20080514145510.GR4401@merkur.hilbert.loc обсуждение исходный текст |
Ответ на | Re: ranked subqueries vs distinct question (Decibel! <decibel@decibel.org>) |
Ответы |
Re: ranked subqueries vs distinct question
|
Список | pgsql-general |
On Wed, May 14, 2008 at 09:35:10AM -0500, Decibel! wrote: > SELECT name, zip, zip='04317' AS zipmatch > FROM urb LEFT JOIN streets ON (streets.urb_id = urb.urb_id ) > ORDER BY zipmatch DESC, name > ; The view dem.v_zip2data (which I erronously left out in my first post) does just that - it joins streets to urbs thereby providing urbs with zip codes from the streets table. It, however, only joins those rows which do have a zip code. That leaves out those cities which don't. Which makes me want to UNION on the dem.urb table in the initial problem. > Of course you'll need to adjust the table and field names appropriately. No problem, I can do that. I am not getting the approach right yet. Karsten -- GPG key ID E4071346 @ wwwkeys.pgp.net E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346
В списке pgsql-general по дате отправления: