I’m using PostgreSQL and currently creating a stored procedure to do some calculations. I’ve been searching all morning and reading the documentation, but either the functionality I want isn’t supported or I must’ve overlooked something. Basically, this is what I have: Basically what happens is that I calculate how often I need to make a travel to deliver something, which
Tag: arrays
How to extract only rows matching condition ‘WHERE column1 IN column2’ (where column2 is an array)?
I am using postgresql. Let’s suppose I have this table name my_table: I want to select only the rows having the value of idm equal to one of the elements of the array in stores (of that line). So I want to get something like this: I have tryed with but I get a syntax error. Answer You need to
How to get rid of response headings in Google Sheets?
I read an API with Google Sheets and want to get results similarly to this: But the API is a bit strange and puts always a header row into response. With it, the response of the first formula looks like: and the second formula (=MyApiFormula(A3)) doesn’t work at all – sure, because it is forced to write into cells with
how to get slice of an array in AWS Athena?
I have an array of unknown length in AWS Athena. I want to get all elements expect for the first one and concatenate into a string. I can do with a known length, but I don’t see how for unknown length. In this example: What I want is myslice_joined. I could use slice because I knew it had four elements,
Presto – How to convert a field with map to rows
I’m new to Presto SQL and I am stuck to a issue and I really need your help. I have a table with a field “Info”: I want to pull all order_id(s) and convert them as rows, the output may look like this: My query: I tried the query above but it can only returns the order_id as an array.
How to separate everything inside my sqlite database
i have a database which has two thing in my database, name of a fruit and how long is it in the freezer. when i use rows will actually show the name of the fruit, time in freezer and the amount of fruit in batch How do i separate this, so that Or at least tell me how do i
PostgreSQL: Create array by grouping values of the same id
Given the following input data: id category 1 A 1 B 2 A 2 R 2 C 3 Z I aim aiming to get the following output table: id categories 1 {“A”,”B”} 2 {“A”,”R”,”C”} 3 {“Z”} using the following query: But what I get is the following table: id categories 1 {“A”,”B”,”R”,”C”,”Z”} 2 {“A”,”B”,”R”,”C”,”Z”} 3 {“A”,”B”,”R”,”C”,”Z”} How can I obtain
Nested array in a SQL query
I’m fairly new to programming and I’m struggling with an SQL Query. I want, that the purchased articles (article_id) are grouped in an array, so they are connected to the date column. For a further process, they might be combined ( so date x is combined with articles_id [A,B,C]) To make it clearer I want to show what I’ve done
Repeating JSON Aggregated Array with Row Limits
I have an Oracle 19 database with a JSON aggregated array which I need to cut off and repeat after a set number of rows, for example: …etc. Here’s some basic SQL to illustrate how my current dataset is put together: I need to push customer data to an API endpoint. Pushing 1 customer record at a time is not
Is there a (key:value) pair datatype that can be used as a column in SQL – Specifically Google Cloud Spanner?
Given the scenario that I would like to store sales of a store in a table in a database in Google Cloud Spanner. That table would (in addition to the sale ID as the primary key) have to store a list of product IDs sold, along with the quantity of each product sold. Ideally, this would be in the form