Dans mon tableau, j'ai une colonne nommée facebook comme type text []. Par exemple, une ligne est:Postgres - sélection d'un élément du tableau
{{total_count,26861},{comment_count,94},{comment_plugin_count,0},{share_count,26631},{reaction_count,136}}
Maintenant, j'essaie de sélectionner uniquement total_count. J'ai essayé everythin et se termine par ceci:
SELECT json_each(to_json(facebook))->>'total_count' AS total_count"
Mais je reçois une erreur: opérateur n'existe pas: enregistrement - >> inconnu \ nLigne 1:
Toutes les idées?
// modifier
Maintenant, j'ai ce
$select = "WITH fejs AS (select json_array_elements(to_json(facebook)) e FROM $table), arr AS (select e->1 as total_count FROM fejs WHERE e->>0 = 'total_count') SELECT ".implode(", ", SSP::pluckas($columns))."
, count(*) OVER() AS full_count
FROM $table
$where
$order
$limit";
Est-il possible que je peux ajouter TOTAL_COUNT COMMANDER?