Milo,
This is called a derived table and can be code as:
SELECT * FROM (SELECT * FROM A_Table) AS Derived_Table
The derived table inside the ( ) can be of arbitrary complexity. A simple
example:
SELECT * FROM
(SELECT c.CustomerID,
SUM(r.Receipts) AS TotalReceipts,
MAX(r.ReceiptDate) AS MostRecentReceiptDate
FROM SalesReceipts r
JOIN Customers c ON r.CustomerID = c.CustomerID
WHERE c.CustomerActive = 1
GROUP BY CustomerID) AS Derived_Table
RLF
"Milo" <anisha (AT) indiamail (DOT) com> wrote
Quote:
Is it possible to SELECT query from the result of a select query, without
creating temp table? and how any reference?
example:
ie... select * from (<select statement>)
many thanks.
--
Milo |