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).

Find duplicate entries in a column

I am writing this query to find duplicate CTN Records in table1. So my thinking is if the CTN_NO …

sql oracle subquery
MySQL How do you INSERT INTO a table with a SELECT subquery returning multiple rows?

MySQL How do you INSERT INTO a table with a SELECT subquery returning multiple rows? INSERT INTO Results ( People, names, ) …

mysql select subquery insert-into
How does Subquery in select statement work in oracle

I have looked all over for an explanation, to how does the subquery in a select statement work and still …

sql oracle select group-by subquery
T-SQL Subquery Max(Date) and Joins

I'm trying to join multiple tables, but one of the tables has multiple records for a partid with different dates. …

sql sql-server tsql join subquery
What is the difference between LATERAL and a subquery in PostgreSQL?

Since Postgres came out with the ability to do LATERAL joins, I've been reading up on it, since I currently …

sql postgresql subquery lateral-join
Use results from one sql query in another where statement (subquery?)

I see many similar questions but they're either so complex I can't understand them, or they don't seem to be …

mysql sql subquery
SQL Server - use columns from the main query in the subquery

Is there any way to get a column in real time, from a main query, and use it in a …

sql sql-server subquery field
How to reuse a result column in an expression for another result column

Example: SELECT (SELECT SUM(...) FROM ...) as turnover, (SELECT SUM(...) FROM ...) as cost, turnover - cost as profit Sure this is …

sql postgresql subquery
How to use MAX() on a subquery result?

I am new to Oracle and the SQL world. I have a slight issue with a query that I cannot …

sql oracle subquery aggregate-functions max
SQL - Subquery in Aggregate Function

I'm using the northwind database to refresh my SQL skills by creating some more or less complex queries. Unfortunately I …

sql subquery sql-server-2012 aggregate-functions northwind