From: legrand legrand <legrand_legrand@hotmail.com>
To: pgsql-general@postgresql.org
Subject: Re: Return select statement with sql case statement
Date: Wed, 4 Jul 2018 09:17:27 -0700 (MST)
Message-ID: <1530721047714-0.post@n3.nabble.com> (raw)
In-Reply-To: <CAMsqVxsqXZ=DXZrn-gDXgpkGLrFpTpi5Ab2Ky9nKD7Kd1n_uXA@mail.gmail.com>
References: <CAMsqVxuBE0iHU=-_LCS2PyonGFvJwgrs6LLrzuGU53m7VqYBQA@mail.gmail.com>
<3524c35d-e566-9bad-e4bd-d493f05f2d4d@gmail.com>
<CAMsqVxsqXZ=DXZrn-gDXgpkGLrFpTpi5Ab2Ky9nKD7Kd1n_uXA@mail.gmail.com>
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 instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: legrand_legrand@hotmail.com
Subject: Re: Return select statement with sql case statement
In-Reply-To: <1530721047714-0.post@n3.nabble.com>
References: <CAMsqVxuBE0iHU=-_LCS2PyonGFvJwgrs6LLrzuGU53m7VqYBQA@mail.gmail.com> <3524c35d-e566-9bad-e4bd-d493f05f2d4d@gmail.com> <CAMsqVxsqXZ=DXZrn-gDXgpkGLrFpTpi5Ab2Ky9nKD7Kd1n_uXA@mail.gmail.com> <1530721047714-0.post@n3.nabble.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox