Re: Return select statement with sql case statement - Mailing list pgsql-general

From legrand legrand
Subject Re: Return select statement with sql case statement
Date
Msg-id 1530721047714-0.post@n3.nabble.com
Whole thread Raw
In response to Re: Return select statement with sql case statement  (hmidi slim <hmidi.slim2@gmail.com>)
List 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 by date:

Previous
From: Tom Lane
Date:
Subject: Re: Postgres sometimes stalling on 'percentile_cont'
Next
From: Boblitz John
Date:
Subject: RE: Unable to Connect to DB Instance