2 Replies Latest reply on Nov 2, 2018 1:45 PM by oolabode

    Using aliases in PIOLEDB provider SQL queries in SSRS

    oolabode

      Hello Experts,

       

      I would like to create a query using the piavg table where three column aliases are used in a calculation for a fourth column.

       

      Here is the query I am using:

      select

      a. time,

      a.value as Test1,

      b.value as Test2,

      c.value as Test3,

      If test1 >50 then Test2*Test3/1.8 as Test4

       

      from

      (select tag, time, value from [piarchive]..[piavg]

        where tag ='tag1' and time between date(?) and date(?) and  timestep ='24h' and calcbasis ='eventweighted') a,

      (select tag, time, value from [piarchive]..[piavg]

        where tag ='tag2' and time between date(?) and date(?) and  timestep ='24h' and calcbasis ='eventweighted') b,

      (select tag, time, value from [piarchive]..[piavg]

        where tag ='tag2' and time between date(?) and date(?) and  timestep ='24h' and calcbasis ='eventweighted') c

      where

      a.time = b.time

      and b.time = c.time

       

       

      Regards,

      OO