Re: SQL Help

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: SQL Help
Дата
Msg-id 200305300937.12158.josh@agliodbs.com
обсуждение исходный текст
Ответ на SQL Help  (C F <tacnaboyz@yahoo.com>)
Список pgsql-sql
CF,

> select
>   (case when column1 = column2 then column3 end) as alias1,
>   (case when column1 = column2 then column4 end) as alias2,
>   (case when column1 = column2 then column5 end) as alias3,
>   (case when column6 = column7 then column8 end) as alias4
> from
>   mytable

Given the information you've given us (including your first e-mail), I can't 
think of a better way to get the output you want than the above.  You could 
work through subselects, etc, but I think that would be even less efficient.

One thing you might want to think about is your whole approach to designing 
this application; it may be that you can simplify your queries by changing 
your table design.  

-- 
Josh Berkus
Aglio Database Solutions
San Francisco


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

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: SQL Help
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: CASE returning multiple values (was SQL Help)