Top "Subquery" questions

"subquery" is vague SQL terminology, used to describe when there's either more than one `SELECT` statement in a query, or when used in Data Manipulation Language (DML) statements (IE: DELETE, UPDATE, INSERT, MERGE).

how to do subqueries in bigquery?

Im trying to play with the reddit data on bigquery and I want to see comments and replies in one …

sql subquery google-bigquery reddit bigdata
FULL OUTER JOIN with two subselects gives "ORA-00918: column ambiguously defined"

both Subselects runs fine standalone. But I wish to join them togehter, which always gives "ORA-00918: column ambiguously defined". I …

sql oracle join subquery ora-00918
How to reuse a sub query in sql?

I have query like the following select columns from (select columns1 from result_set where condition_common and condition1) as …

sql sql-server tsql subquery
Query with HAVING and WHERE

I'm trying to create a single query that will combine the following two queries. SELECT campgroundid, ( 3959 * acos( cos( radians(37) ) * cos( …

sql mysql subquery in-subquery
Hibernate Subquery and DetachedCriteria

I have created a DetachedCriteria that is retrieving estates that have the isApproved and isPublished set to true. It is …

hibernate detachedcriteria subquery
Setting alias name from a subquery in SQL

In my Select query I just want to to set the alias name of a column based on a sub-query (…

sql-server sql-server-2008 subquery aliasing
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
How to select most frequent value in a column per each id group?

I have a table in SQL that looks like this: user_id | data1 0 | 6 0 | 6 0 | 6 0 | 1 0 | 1 0 | 2 1 | 5 1 | 5 1 | 3 1 | 3 1 | 3 1 | 7 I want to write a query that …

sql postgresql select subquery
SOQL issue when querying ActivityHi​story as a subquery..​

I'm querying ActivityHistory, and it seems that you can only query it as the object of a SUBQUERY against some …

subquery salesforce soql
Procedurally transform subquery into join

Is there a generalized procedure or algorithm for transforming a SQL subquery into a join, or vice versa? That is, …

sql algorithm join subquery relational-model