Would you please use PIDAS?How to use PIDAS to get the hourly data of the day。 could you help me ？
Can you provide more details? You want the hourly max or min or average or something else? I suppose by PIDAS, you mean PI OLEDB Provider?
yes.I want to pull out the data in PI server.And I only want the hourly data for today.For example, 2018/12/15 01:00;2:00, etc.Now I need to write down this time condition, but I don't know how to write it.So, I hope you can give me some help.Thank you very much
SELECT tag, time, value,status
FROM piarchive..piinterp2 WHERE time >'t' and time<'*' and timestep='1h'
If I want to extract the data closest to the full point, what should I write when editing SQL?Let's say I have two Numbers, 12:09 and 12:20, and I want to take out the 12:09 data.
That problem has been solved. Thank you very much.I would also like to know how to write the SQL for the data I want to query the day before or one day, or can you tell me where I have the information about PI SQL?
For PI time syntax, "y" refers to the midnight of yesterday. You can use this in conjunction with "t" to get the data for the day before. The PI OLEDB Provider 2017 R2 SP1 User Guide can be found on the techsupport website.
Hello, I would like to ask how to query multiple tag points in one SQL statement at the same time. I am using it 'SELECT tag, time, value FROM piarchive..picomp where tag = 'U4LDC_MW' or tag='U3LDC_MW' and time = DATE(N'*')'，An error display is 'Failed to retrieve events from server. [-10722] PINET: Timeout on PI RPC or System Call.'
The "OR" condition for tags will try to return all the rows in picomp table where the 'tag' column equals 'U4LDC_MW' or 'U3LDC_MW'. Hence this query tries to query all the data for the 2 tags and eventually times out.
Use "IN" clause in place of "OR" to query data for multiple tags.
SELECT tag, time, value FROM piarchive..picomp where tag in ('sinusoid','sinusoidu') and time = Date(N'*')
SELECT tag, time, value FROM piarchive..picomp where tag in ('sinusoid','sinusoidu') and time between '*-10h' and '*'
If you want to query just the snapshot values the below query would work, since pisnapshot table will have one row for each tag with it's snaphost value
SELECT tag, time, value from piarchive..pisnapshot where tag = 'sinusoid' or tag ='sinusoidu'
Or check out this online LiveLibrary in addition to offline material, provided by Eugene
PI OLEDB Provider - Compendium of PI SQL Statements for tag based query
PI OLEDB Enterprise - Compendium of PI SQL Statements for PI AF for asset based query
Hope this helps!
Retrieving data ...