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

MySQL #1093 - You can't specify target table 'giveaways' for update in FROM clause

I tried: UPDATE giveaways SET winner = '1' WHERE ID = (SELECT MAX(ID) FROM giveaways) But it gives: #1093 - You …

mysql sql select subquery mysql-error-1093
Is there a way to give a subquery an alias in Oracle 11g SQL?

Is there a way to give a subquery in Oracle 11g an alias like: select * from (select client_ref_id, …

sql oracle subquery oracle11g table-alias
SQL Like with a subquery

How can i make this work? SELECT * FROM item WHERE item_name LIKE '%' || (SELECT equipment_type FROM equipment_…

sql subquery wildcard
MySql Select, Count(*) and SubQueries in Users<>Comments relations

I have a task to count the quantity of users having count of comments > X. My SQL-query looks like …

mysql sql subquery aggregate-functions
MYSQL use 'LIKE' in 'WHERE' clause to search in subquery

How would you use 'LIKE' to search in a subquery? E.g. i've tried doing this, but doesn't work: SELECT * …

mysql sql subquery where-clause sql-like
Subqueries with EXISTS vs IN - MySQL

Below two queries are subqueries. Both are the same and both works fine for me. But the problem is Method 1 …

mysql sql phpmyadmin query-optimization subquery
Count rows with a specific condition in aggregate query

I have this query to get the number of PlayerSessions with reconnect = TRUE, grouped by Player.country: SELECT country, COUNT(*) …

mysql sql count subquery aggregate-functions
In which sequence are queries and sub-queries executed by the SQL engine?

Hello I made a SQL test and dubious/curious about one question: In which sequence are queries and sub-queries executed …

sql subquery
When to use SQL sub-queries versus a standard join?

I am working on rewriting some poorly written SQL queries and they are over-utilizing sub-queries. I am looking for best-practices …

sql join subquery
CROSS/OUTER APPLY in MySQL

I need to use CROSS APPLY in MySQL (EC2 RDS MySQL instance). Looks like MySQL doesn't recognise the CROSS APPLY …

mysql join subquery cross-apply