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

Reply via email to