Re: Return select statement with sql case statement
| От | legrand legrand |
|---|---|
| Тема | Re: Return select statement with sql case statement |
| Дата | |
| Msg-id | 1530721047714-0.post@n3.nabble.com обсуждение исходный текст |
| Ответ на | Re: Return select statement with sql case statement (hmidi slim <hmidi.slim2@gmail.com>) |
| Список | pgsql-general |
Hello,
sorry your description is not clear ...
why do you use a GROUP BY on product without aggregation function min, max,
sum ?
where is defined numberOfPremiumDays ?
may be using UNION can solve your problem:
select
numberOfPremiumDays,
product_id,
premium_price,
period_price
from product, PremiumDays
where occupation_type_id = 1
and numberOfPremiumDays = date_part('day',
('2018-11-05'::timestamp) - ('2018-11-01'::timestamp))
UNION ALL
select
numberOfPremiumDays,
product_id,
classic_price,
period_price
from product1, PremiumDays
where occupation_type_id = 1
and numberOfPremiumDays != date_part('day',
('2018-11-05'::timestamp) - ('2018-11-01'::timestamp))
Regards
PAscal
--
Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html
В списке pgsql-general по дате отправления: