simardcl

Pi Oledb order return on tag in where condition

Discussion created by simardcl on Oct 27, 2020
Latest reply on Oct 28, 2020 by simardcl

Hello all,

 

Is there any way to make the return results to respect the order define into the where TAG in clause ? Returns are sorted ASC by default can we change that ?

 

Example :

 

SELECT tag, time, value FROM piarchive.PiAvg WHERE tag IN ('TD01.PV','TD02.PV','TD03.PV','TD04.PV','TD05.PV','TD11.PV','TD02P-C.PV','TD02P-.PV','TD05N-C.PV','TD05N-P.PV','TD09P-C.PV','TD09P-C.PV','TD11N-C.PV','TD11N-P.PV') AND time between '2020/10/24 15:00:00' and '2020/10/27 15:14:00' and timestep='15m'

 

Will return data in this order (sorted on tag name )

 

TD01

TD02

TD02P-C

TD02P-P

TD03

TD04

TD05

TD05N-C

TD05N-P

TD09P-C

TD09P-P

TD11

TD11N-C

TD11N-P

 

Is there an easy way to make results return in the order specify into the tag in clause ?

 

Thanks

Outcomes