I have two following JSON Array in details field of my table and need to evaluate the query as I use in another relational table. { “city”: “London”, “name”: “Sainburry”, “quantities”: […
Tag: arrays
Merge Two JSON array columns in Mysql 8
I am using Mysql (version > 8). I have a table where I am storing unique customer ids for the day in an JSON field as an array. I need to query for all unique customers in last 30 days. I am unable to find an equivalent mysql query for the same. I am using JSON_ARRAYAGG to first merge all
How to fetch value from JSON document inside MySQL column?
I have written following MySQL Json Array query. The Mysql version is 8.0.18-commercial select r.network, s.server from table1 e inner join table2 s on e.objectId = s.envId inner …
How do I get IDs associated with the most frequent value in PostgreSQL?
I have following data in my PostgreSQL 11 database count_tbl (Windows 10 x64 machine). The following query, for each group (grp), finds the most frequent value: The output of above query is: Now, I would like to associate the most frequent value to the corresponding IDs (for example, for grp = 1, most frequent value 19.7 have ids 1, 2,
Perform UNNEST, INNER JOIN and then ARRAY_AGG as part of an UPDATE query
I am trying to unnest an array from one table using ORDINALITY to preserve order, then perform an INNER JOIN on another table to find the corresponding value from a specific column and then use ARRAY_AGG to package this back up and UPDATE the original table. I have something working for a single query, but I want to do an
How to get Table field names at top of result array
Here is my Sample table: Here is My Query: Result for above query is: I need to get the field names in the first element of the array. Expected result array is: How can I modify the Query to get this result? Thanks in advance… Answer Display issues should generally be dealt with in application code, not SQL queries. If
Postgres jsonb field to array
I was going through the Postgres Jsonb documentation but was unable to find a solution for a small issue I’m having. I’ve got a table : MY_TABLE that has the following columns: User, Name, Data and …
system.linq.enumaerable+<Cast… in combobox C#
I have a SQL query that reads string data from a SQL Express DB (Changing over to Azure). Once the data is retrieved, I read it into an array and then display the contents of the array in a combo-box. i am not receiving any error however, in the combo-box, an extra field is displayed and I cannot fgure out
‘Tagging’ a record using multiple criteria
I am using Presto. I want to assign a row with multiple ‘tags’ using different criteria that are not mutually exclusive. For example, let’s say there’s a table with 4 columns: | food | color |…
JSON_CONTAINS for multiple attributes on object in array?
Currently using MYSQL 5.7, soon to be migrating to 8.0. We have a json field in our database which has values which look like this: [ { “first_name”:”bob”, “last_name”:”lisserman” }, {…