Skip to content

Tag: sql

fetch the data from array of objects sql BigQuery

I need to fetch key value pairs from the second object in array. Also, need to create new columns with the fetched data. I am only interested in the second object, some arrays have 3 objects, some have 4 etc. The data looks like this: The desired output: Answer Below is for BigQuery Standard SQL if applied to…

Select how many documents are in other table for each person

I have 3 tables. Client,Documents and ClientDocuments. The first one is the clients,where the information for each client are. The second one is the documents, which document can go in the system. The third one is the ClientDocuments, which client has which document. Tables Here I have to do a select where i …

Incorrect datetime value in MySQL table

I have just created a new MySQL in an AWS Ubuntu instance. Then I have copied a table from another MySQL server to the new created database. This is the structure from some fields from one of the tables: My issue is that every time I try to enter a new record on the table, there is an error at

How do I select just mutual rows in SQL?

I have a table with a source_id and destination_id and a message and I want to group messages together. There can only be one message between a given source_id and destination_id, but I only want rows that have a mutual response for a given ID (say id 1). In the following examples, I want rows #1, #2, #4 and …