Introduction
In this article I am going to explain how to use Subqueries in SQL. A select statement known as subquery if it is codded within another SQL statement. Subquery can return a single value or a result set. This result set may contain a single column or more than one column.
There are four way to create subquery in a SELECT statement.
- In WHERE Clause
- In HAVING Clause
- In FROM Clause
- In SELECT Clause
Example
select * from mcninvoices
where invoicetotal >
( select avg(invoicetotal) from invoices )
|
Output
Source : http://www.dotnetheaven.com/article/how-to-use-subqueries-in-sql
0 comments:
Post a Comment