Re: ranked subqueries vs distinct question

Поиск
Список
Период
Сортировка
Искать
От
David McNett
Тема
Re: ranked subqueries vs distinct question
Дата
в 11:29:03
Msg-id
5292F47A-F488-4169-899F-35844C588489@macnugget.org
Ответ на
Список
Дерево обсуждения
ranked subqueries vs distinct question Karsten Hilbert <Karsten.Hilbert@gmx.net>
Re: ranked subqueries vs distinct question Stephan Szabo <sszabo@megazone.bigpanda.com>
Re: ranked subqueries vs distinct question Karsten Hilbert <Karsten.Hilbert@gmx.net>
Re: ranked subqueries vs distinct question David McNett <nugget@macnugget.org>
Re: ranked subqueries vs distinct question Karsten Hilbert <Karsten.Hilbert@gmx.net>
Re: ranked subqueries vs distinct question David McNett <nugget@macnugget.org>
Re: ranked subqueries vs distinct question Karsten Hilbert <Karsten.Hilbert@gmx.net>
Re: ranked subqueries vs distinct question Decibel! <decibel@decibel.org>
Re: ranked subqueries vs distinct question Karsten Hilbert <Karsten.Hilbert@gmx.net>
Re: ranked subqueries vs distinct question Karsten Hilbert <Karsten.Hilbert@gmx.net>
Re: ranked subqueries vs distinct question David McNett <nugget@macnugget.org>
Re: ranked subqueries vs distinct question Karsten Hilbert <Karsten.Hilbert@gmx.net>
Re: ranked subqueries vs distinct question Karsten Hilbert <Karsten.Hilbert@gmx.net>
Re: ranked subqueries vs distinct question "mian wang" <lonelycat1984@gmail.com>
Re: ranked subqueries vs distinct question Karsten Hilbert <Karsten.Hilbert@gmx.net>
On May 14, 2008, at 9:07 AM, Karsten Hilbert wrote:
> That doesn't work, unfortunately, because the urb (cities)
> table doesn't have the zip code. That's stored in a street
> table which foreign keys into the urb table. The
> dem.v_zip2data view aggregates streets, cities, states and
> countries for which there is a know linkage to a zip code at
> the street level. IOW, there are cities for which there is
> no known zip code. I want those to be matched, too, of
> course, courtesy of the user typing part of their name.

I think perhaps you have misunderstood what I was suggesting.  If the  
SQL in your original post works, then my suggestion will also work.   
In my haste to reply I accidentally omitted the where clause of the  
query.

Wouldn't this (full example) work?

SELECT
   name,zip,
   (SELECT zip = '04317') as zipmatch
FROM
dem.urb
WHERE name ilike 'lei%'
ORDER BY zipmatch DESC, name;

If your code runs, this will too.
В списке pgsql-general по дате отправления
От: Karsten Hilbert
Дата:
От: Decibel!
Дата:
FAQ