ORDER BY question

Поиск
Список
Период
Сортировка
От Luis H.
Тема ORDER BY question
Дата
Msg-id 000501c3702a$8bbea3d0$0200a8c0@atticus
обсуждение исходный текст
Ответ на Can Postgresql run in MS Windows  (chrizkoh@yahoo.com (Christopher Koh))
Ответы Re: ORDER BY question  (Bruno Wolff III <bruno@wolff.to>)
Re: ORDER BY question  (Nabil Sayegh <nas@e-trolley.de>)
Список pgsql-novice
I have two tables, table A contains users (id, username, password) , and
table B contains a row that signifies the 'owner' of each particular entry,
referencing an id in A.

so example

table A
id  username password
------------------------
1   me           *****
2   you          *******

table B
description           owner
-------------------------
'something cool'   2
'another thing'      1


What I want to do is do a query where I order table B by owner, but
alphabetically by username. The problem, obviously, is that table B only
contains id's (numbers, indexing to A), which don't correspond to the
alphabetical order of the usernames.

I'm not very familiar with subqueries, but I expect I should be able to
somehow select ID's from table A ordered by username, and use this index to
order table B by owner.

Hopefully I made sense.

Thanks in advance!



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

Предыдущее
От: "Luis H"
Дата:
Сообщение: Re: Can Postgresql run in MS Windows
Следующее
От: glenn
Дата:
Сообщение: returning Setof Record