skip to Main Content

Postgresql – Selecting data using jsonb data in WHERE clause

I have the below table - assume tags column always have top level string keys: name(TEXT) | tags(jsonb) -----------+------------------------------------------------------- teamA | {"color": "green", "zone": "primary"} teamB | {"color": "green", "zone": "primary", "role": "user"} teamC | {"uid": "32-232-2dswdwsd", "availability": "condensed"} Let's…

VIEW QUESTION

Postgresql – How to speed up range joins in bigquery

Doing self join with same table with range condition. The below is sql statement. select current_rec .* ,compare_rec.employee_id as less_salary_employee from hr.employees current_rec left join hr.employees compare_rec on current_rec.hire_date < compare_rec .hire_date and current_rec.salary < compare_rec.salary order by current_rec .employee_id…

VIEW QUESTION

Optimizing MySQL query with group_concat

I have an old PHP5 MySQL webapp whose code had to be adapted to PHP8/MySQL14.14 There's a view, querying few tables and based on that code: (SELECT `db_demandes`.`bdd`.`id` AS `Id`, `db_demandes`.`bdd`.`ref` AS `Ref`, `db_demandes`.`bdd`.`nodossier` AS `NoDossier`, `db_demandes`.`bdd`.`agentfirme` AS `Agentfirme`, `db_demandes`.`bdd`.`agentanterieur`…

VIEW QUESTION

How to I deal with '[' and ']' json characters in snowflake?

I'm using snowflake. This is my statement: select PARSE_JSON(src): "eventType"::STRING AS eventtype, PARSE_JSON(PARSE_JSON(src): "data"::STRING): "events" AS events, PARSE_JSON(PARSE_JSON(PARSE_JSON(src): "data"::STRING): "events"): "actor" AS actor, PARSE_JSON(PARSE_JSON(PARSE_JSON(PARSE_JSON(src): "data"::STRING): "events"): "actor"): "actor" AS actor2, PARSE_JSON(PARSE_JSON(PARSE_JSON(src): "data"::STRING): "events"): "client" AS client, * from stage.okta_events This…

VIEW QUESTION
Back To Top
Search