Search Postgresql Archives

Re: ranked subqueries vs distinct question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux