Re: [GENERAL] Simple question....

Поиск
Список
Период
Сортировка
От Matthew Hixson
Тема Re: [GENERAL] Simple question....
Дата
Msg-id Pine.LNX.3.96.981123224011.13718B-100000@www.frozenwave.com
обсуждение исходный текст
Ответ на Simple question....  (Summer <summerd@cs.unm.edu>)
Список pgsql-general
On Mon, 23 Nov 1998, Summer wrote:

> I have a table with a couple of varchar columns that needs to have all it
> values all capitalized.
>
> SO this :
>
>       id|last_name|first_m  |login_id|sex
>     ----+---------+---------+--------+---
>     1231|Reid     |Samuel R.|sreid   |M
>
> would become :
>
>       id|last_name|first_m  |login_id|sex
>     ----+---------+---------+--------+---
>     1231|REID     |SAMUEL R.|sreid   |M
>
> This way when I bring them up alphabetically - it will be correct.
> I remember seeing this on the list a couple of months ago but I cannot
> remember the fix...

I think what you want is something like this:

select *,upper(last_name) as last,upper(first_m) as first from <table>
order by last, first;

This will make your output look like this:

         id|last_name|first_m  |login_id|sex|last|first
       ----+---------+---------+--------+---+----+-----
       1231|Reid     |Samuel R.|sreid   |M  |REID|SAMUEL R.

If you're using this select within another program then you don't have to
display the 'last' and 'first' columns to the end user.  Just use it
internally to order the rows.
  -M@

--
Matthew Hixson - CIO              Linux, n;
FroZenWave Communications           the nouveau postmodern operating
http://www.frozenwave.com           system for the masses



В списке pgsql-general по дате отправления:

Предыдущее
От: "Ȳ¸¶´ã"
Дата:
Сообщение: help me...postgres....
Следующее
От: Richard Jones
Дата:
Сообщение: braindead postmaster