lateral Questions

2

I have a variant data type that I am performing a lateral flatten on but I then need to left join one of the json elements to lookup the value for the corresponding ID from another relational table...
P asked 13/8, 2020 at 14:8

3

My use case is I am having one table in hive which has one column as INT and one as Array data type. I want to display it horizontally..
Departure asked 30/11, 2015 at 7:6

2

Solved

I'm trying to test out the json type in PostgreSQL 9.3. I have a json column called data in a table called reports. The JSON looks something like this: { "objects": [ {"src":"foo.png"}, {"src":...
Rainband asked 29/3, 2014 at 20:50

1

Solved

JOIN SELECT * FROM a INNER JOIN ( SELECT b.id, Count(*) AS Count FROM b GROUP BY b.id ) AS b ON b.id = a.id; LATERAL SELECT * FROM a, LATERAL ( SELECT Count(*) AS Count FROM b WHERE a.i...
Creek asked 3/4, 2018 at 7:28

3

I'd like to convert single rows into multiple rows in PostgreSQL, where some of the columns are removed. Here's an example of the current output: name | st | ot | dt | -----|----|----|----| Fred |...
Tetracycline asked 19/7, 2017 at 21:17

4

Solved

Recently upgraded to using PostgreSQL 9.3.1 to leverage the JSONfunctionalities. In my table I have a json type column that has a structure like this: { "id": "123", "name": "foo", "emails":[ ...
Elinaelinor asked 24/10, 2013 at 13:59

4

Solved

I need to migrate SQL queries written for MS SQL Server 2005 to Postgres 9.1. What is the best way to substitute for CROSS APPLY in this query? SELECT * FROM V_CitizenVersions CROSS APPLY dbo....
Meryl asked 13/7, 2012 at 14:44

1

Solved

I have the following query: query = "SELECT data #>> '{id}' AS id, data #>> '{name}' AS name, data #>> '{curator}' AS curator, data #> '{$isValid}' AS \"$isValid\", data...
Graceless asked 4/1, 2016 at 18:42

2

Solved

Given a table defined as such: CREATE TABLE test_values(name TEXT, values INTEGER[]); ...and the following values: | name | values | +-------+---------+ | hello | {1,2,3} | | world | {4,5,6} | I'...
Hubsher asked 13/8, 2015 at 20:18

1

Solved

I have the following data in a matches table: 5;{"Id":1,"Teams":[{"Name":"TeamA","Players":[{"Name":"AAA"},{"Name":"BBB"}]},{"Name":"TeamB","Players":[{"Name":"CCC"},{"Name":"DDD"}]}],"TeamRank":[...
Teacup asked 29/5, 2015 at 0:55

1

Solved

I am trying to join table and function which returns rows: SELECT p.id, p.name, f.action, f.amount FROM person p JOIN calculate_payments(p.id) f(id, action, amount) ON (f.id = p.id); This functi...
Spiker asked 4/3, 2015 at 11:8

3

Solved

I have a function called generate_table, that takes 2 input parameters (rundate::date and branch::varchar) Now I am trying to work on a second function, using PLPGSQL, that will get a list of all ...
Gamopetalous asked 14/3, 2014 at 15:56

1

Solved

I have a table of rows with the following structure name TEXT, favorite_colors TEXT[], group_name INTEGER where each row has a list of everyone's favorite colors and the group that person belongs t...
Pollster asked 9/1, 2014 at 23:24

2

Solved

I'm running PostgreSQL 9.2.1 and have a plpgsql function that returns 3 columns. It's called like this (simplified): SELECT (my_function(b.input)).*, a.other, b.columns FROM table_a a JOIN table_b...
Rascality asked 21/2, 2013 at 9:53

3

Solved

I'm trying to call a stored procedure passing parameters in a left outer join like this: select i.name,sp.* from items i left join compute_prices(i.id,current_date) as sp(price numeric(15,2), di...
Historicity asked 8/2, 2013 at 12:37
1

© 2022 - 2024 — McMap. All rights reserved.