Re: Return select statement with sql case statement

From: legrand legrand <legrand_legrand(at)hotmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Return select statement with sql case statement
Date: 2018-07-04 16:17:27
Message-ID: 1530721047714-0.post@n3.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Boblitz John 2018-07-04 17:07:19 RE: Unable to Connect to DB Instance
Previous Message Tom Lane 2018-07-04 16:01:53 Re: Postgres sometimes stalling on 'percentile_cont'