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

SELECT INTO with subquery

Regarding SELECT INTO in SQL Server The following throw an error Incorrect syntax near ')'. SELECT * INTO Sales.MyTable …

sql-server subquery common-table-expression select-into
How to use subquery in the join function of Yii framework 2 ActiveRecord?

Below is my pure SQL query. SELECT a.*, b.* FROM a INNER JOIN b ON a.id = b.a_id …

sql yii2 subquery inner-join
SQL syntax error: near "("

When I try to run this query: select branch_no, max (avg_salary) from (select allocatedto, avg (salary) from staff, …

sql sqlite subquery derived-table
Hibernate criteria api 'Select in'

is it possible to create a 'select in'-query with the hibernate critiria api ? Example : I have two tables in a 1:…

hibernate subquery hibernate-criteria
How do I avoid repeating this subquery for the IN clause?

I have an SQL script (currently running against SQLite, but it should probably work against any DB engine) that uses …

sql subquery dry in-clause
MySQL where clause and ordering by avg() as a sub query

Although I can group and order by on an aliased sub query, I can't use the alias in a where …

mysql subquery where average clause
MySQL check if subquery return NULL, then replace value

I have mysql query where I need to replace value in WHERE clause if subquery returns no results or null …

mysql null subquery ifnull
Zend_Db_Table subquery

I have a some SQL that I want to use with ZendFW, but I can't get it working and it's …

php zend-framework subquery zend-db-table
How can I use Solr subquery similar to rdbms subqueries?

I need to run a query in Solr that contains another query as terms of the main query! Something like …

solr subquery solr-query-syntax