Top "Correlated-subquery" questions

Correlated sub-query is a sub-query (a query nested inside another query) that uses values from the outer query.

Generate sql with subquery as a column in select statement using SQLAlchemy

Is there a way to make SQLAlchemy generate a query with a custom column that is a subquery that correlates …

python postgresql sqlalchemy correlated-subquery
"invalid reference to FROM-clause entry for table" in Postgres query

I have the following query: query = "SELECT data #>> '{id}' AS id, data #>> '{name}…

sql postgresql correlated-subquery jsonb lateral
Select distinct values with count in PostgreSQL

This is a heavily simplified version of an SQL problem I'm dealing with. Let's say I've got a table of …

sql postgresql-9.1 correlated-subquery
Subquery returning multiple rows during update

I have two tables T_SUBJECTS (subject_id, date_of_birth) and T_ADMISSIONS (visit_id, subject_id, date_of_…

oracle correlated-subquery ora-01427
Using outer query result in a subquery in postgresql

I have two tables points and contacts and I'm trying to get the average points.score per contact grouped on …

sql postgresql correlated-subquery
ERROR: subquery in FROM cannot refer to other relations of same query level

I'm working with PostgreSQL 9 and I want to find the nearest neighbor inside table RP for all tuples in RQ, …

sql postgresql subquery nearest-neighbor correlated-subquery
Can I get comma separated values from sub query? If not, how to get this done?

I have a table Create table Country_State_Mapping ( Country nvarchar(max), State nvarchar(max) ) With 5 records. Insert into Country_…

sql-server tsql correlated-subquery