Re: ORDER BY with exception

Поиск
Список
Период
Сортировка
От brian
Тема Re: ORDER BY with exception
Дата
Msg-id 467B1BEC.2050009@zijn-digital.com
обсуждение исходный текст
Ответ на Re: ORDER BY with exception  ("Josh Tolley" <eggyknap@gmail.com>)
Список pgsql-general
Josh Tolley wrote:
> It seems to me you could replace it all with one query, something like
> this:
>
> SELECT discipline, COUNT(1) FROM showcase WHERE EXISTS (SELECT * FROM
> showcase_item WHERE showcase_id = showcase.id LIMIT 1) GROUP BY
> discipline ORDER BY (discipline != 'other'), discipline;
>

discipline is its own table, not a column, so i'd need to throw a join
in there. I have another table, showcase_discipline to relate from
showcases. I did it this way because there are several other tables that
rely on disciplines (one to one and many to one).

And thanks for the ORDER BY tip! I had no idea i could do that. I'll see
if i can work that in.

brian

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

Предыдущее
От: Michael Glaesemann
Дата:
Сообщение: Re: ORDER BY with exception
Следующее
От: brian
Дата:
Сообщение: Re: ORDER BY with exception