Just a fix - the last example had a mistake in and should read:
Option 2 (CTE):
WITH Q (c1, c2, cd, ac) AS (
SELECT c1, c2, CurrentDate, (CASE ActiveCol WHEN 0 THEN c3 ELSE
c4 END)
FROM ...
)
SELECT c1, c2, cd, ac, MyFn(c1,ac,cd) AS xc1, MyFn(c2,ac,cd) AS xc2
On 2016/06/20 6:21 PM, Bernard Ertl wrote:
Is it possible to do something like this:
SELECT c1, c2, CurrentDate, (CASE ActiveCol WHEN 0 THEN c3 ELSE c4 END) AS ac,
MyFn(c1,ac,CurrentDate) AS xc1, MyFn(c2,ac,CurrentDate) AS xc2 FROM ...
where c1, c2, CurrentDate, ActiveCol, c3, c4 are
On Mon, Jun 20, 2016 at 10:21 AM, Bernard Ertl wrote:
> Is it possible to do something like this:
>
> SELECT c1, c2, CurrentDate, (CASE ActiveCol WHEN 0 THEN c3 ELSE c4 END) AS
> ac,
> MyFn(c1,ac,CurrentDate) AS xc1, MyFn(c2,ac,CurrentDate) AS xc2 FROM
> ...
>
Is it possible to do something like this:
SELECT c1, c2, CurrentDate, (CASE ActiveCol WHEN 0 THEN c3 ELSE c4 END) AS ac,
MyFn(c1,ac,CurrentDate) AS xc1, MyFn(c2,ac,CurrentDate) AS xc2 FROM ...
where c1, c2, CurrentDate, ActiveCol, c3, c4 are all columns in the table(s)
referenced in the
4 matches
Mail list logo