Skip to content

Tag: sql

Display individual elements from grouped rows on same row

I want to both group some rows together but return 1 column of the individual rows from the group onto the same line as well, probably easiest to show with an example…. Original Data Grouped by rDate, track, AVG(odds) Desired output, grouped with average odds but with individual odds added to grouped ro…

How to get JSONB array index

I’m sure there’s a simple answer to this but I just can’t find it. I need to obtain JSON array elements as rows, but their index is relevant for the subsequent processing. Here’s a [very simplified] example: I need to get: I’ve tried: But the section column is not computed correc…

Finding out information from two tables – SQL

everyone! I’m at the point of my SQL learning where I’m having a hard time trying to search to explain what I’m trying to do with SQL but here’s what I got. I have two tables. Let’s call the first one: And the second one: What I’m trying to do is get all account names and t…