1 of 1 people found this helpful
To get this result you will need to create a Transpose function for the required ElementTemplate. This is only possible when using the PI OLEDB Enterprise provider for data access - you can't so this for PI OLEDB Provider (PI Data Archive only) which is what you appear to be using.
2 of 2 people found this helpful
John's answer regarding PI OLEDB Enterprise transpose functions is the best answer as this is the use case for those functions. They're also very scalable when used against element templates.
If you must use PI OLEDB Provider, and you only have 2 (or maybe 3 or 4) tags, then you can self join the snapshot table, filtering down the different copies of itself each by one tag, and outputting the results in the SELECT portion. Something like this:
Self joining the snapshot table is tricky because there's no real join column to use, so I just used 1=1 here. For tables like the piinterp2, you can join the table to itself on the time column for example. This approach though does not scale well, and I would strongly discourage it except in limited use cases.