i have 2 tables, servers and virtual_machines. I want to see the virtual_machines as array in the servers where serverName equals the servers name Like this I have servers tables and virtual_machines tables I tried many options like bellow but i cant make object array in colum and postgre always add key into object. Thanks for any help Answer You
Tag: arrays
sql to pull values from array
I have values in array like below trying to get a result set like below, Answer I think you can use flatten function :
Remove Null from For loop of ArrayList
I am currently converting an ArrayList to a String to send it to a DB so I can retrieve it on the other end and convert it back to an ArrayList later. My thought process is to convert it to a string …
Compare two arrays in PostgreSQL
I have a table in postgres with a value column that contains string arrays. My objective is to find all arrays that contain any of the following strings: {‘cat’, ‘dog’} The following query uses ANY() to check if ‘dog’ is equal to any of the items in each array and will correctly return rows 1 and 3: I am trying
How can I assign pre-determined codes (1,2,3, etc,) to a JSON-type column in PostgreSQL?
I’m extracting a table of 2000+ rows which are park details. One of the columns is JSON type. Image of the table We have about 15 attributes like this and we also have a documentation of pre-determined codes assigned to each attribute. Each row in the extracted table has a different set of attributes that you can see in the
PostgreSQL array overlap with the ALL construct
I want to achieve the same behavior as in next example: select array[1, 3] && array[1] and array[1, 3] && array[2] using the ALL construct like so: select array[1, 3] && all(…
Fill Array from another column SQL
I need help whit my Code (PostgreSQL). I get in my row Result {{2.0,10}{2.0,10}} but I want {{2.0,10}{3.0,20}}. I don’t know where my error is. Result is text [ ] its must be a 2D Array This is Table1 Nummer Name Result 01 Kevin This is Table2 Nummer Exam ProfNr 01 2.0 10 01 3.0 20 My Code is Answer
How to compute running balance from array in ASP.NET MVC controller?
This is my code in controller I want to implement running balance in this array. This query will return Date, debit, credit and balance columns. I have to compute balance on the basis of debit and credit. I want to achieve this: for each row of the array. Hope, you get my point…help me….thanks Answer I have solved the problem.
Test ARRAY whether it contains ALL or NO elements of given ARRAY
Suppose we have an array: With the operator <@ I can query whether the left-operand is a sub-array of the right-operand: The above works greatly but now let’s take the following case: In this case the above will return false as expected. Do we have an operator which says the following: either the left array is contained by the right
Postgres get all elements where value matches from jsonb array
I think I am trying something simple, but after hours I just can’t get it to work. I have a table which contains a tags column, which is a jsonb array and looks like this: I now want to write a query which returns the full object to me, when the name matches the search string. So far I came