I'm currently trying out the "new" data type json. This is part of the definition as php Array (one row of data that is stored in the field)
'processed'=>array(5):
["ct"]=>
int(1)
["wt"]=>
int(11)
["cpu"]=>
int(0)
["mu"]=>
int(1056)
["pmu"]=>
int(0)
I tried the following query:
SELECT id, data->>'processed'>'ct' as sortField FROM system_debug ORDER BY sortField ASC
but all I get in return is an table like 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 to implement Sorting without the needs of storing the data seperatly inside the table. Where am I mistaking?
Table Scheme:
CREATE TABLE system_debug (
data JSON,
id integer NOT NULL
);
CREATE SEQUENCE system_debug_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE system_debug_id_seq OWNED BY system_debug.id;
ALTER TABLE ONLY system_debug ALTER COLUMN id SET DEFAULT nextval(\'system_debug_id_seq\'::regclass);
I appreceate any help that I can get ^^
SELECT id, data->>'processed'->'ct'SELECT id, data->'processed'->'ct'two typos, sorry ;)