php - can't sort data in Postgresql data type json -


i'm trying out "new" data type json. part of definition php array (one row of data stored in field)

'processed'=>array(5):         ["ct"]=>         int(1)         ["wt"]=>         int(11)         ["cpu"]=>         int(0)         ["mu"]=>         int(1056)         ["pmu"]=>         int(0) 

i tried following query:

select id, data->>'processed'>'ct' sortfield system_debug order sortfield asc 

but in return table this:

id  sortfield     6   true     7   true     8   true     9   true     10   true     11   true     12   true     13   true     14   true     15   true     16   true     17   true     18   true 

i'm trying implement sorting without needs of storing data seperatly inside table. mistaking?

table scheme:

                create table system_debug (                     data json,                     id integer not null                 );                  create sequence system_debug_id_seq                 start 1                 increment 1                 no minvalue                 no maxvalue                 cache 1;                  alter sequence system_debug_id_seq owned system_debug.id;                  alter table system_debug alter column id set default nextval(\'system_debug_id_seq\'::regclass); 

i appreceate can ^^

the expression

data->>'processed'>'ct' 

is of type boolean > greater than operator. wanted get

select id, data->'processed'->'ct' ... 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -