Hi guys! There's a "easy/fast" way to rewrite a query from this:
Select datetime,key,value from table where ...
To this:
Select datetime, value1 as key1, value2 as key2, .... From table where ...
I don't remember the right name in R/python (pandas) language but it's something like vector/matrix merge
The ideia is, instead of one line of date key vale, use a single date, and "put" values as columns, and the columns name is the key name
The table structure is something like:
Create table (
Datetime datetime not null,
Key varchar(255) not null,
Value double not null,
Primary key(datetime,key)
)
Any idea is wellcome
I know there's many solutions, if i have >100 columns, if datetime is sparse (only one key have values per datetime value), etc etc
--
Roberto Spadim
SPAEmpresarial - Software ERP
Eng. Automação e Controle