Am just started reading view tutorial
i used this link view tutorial
in this tutorial they said
Subquery cannot be included in the SELECT statement.
but they gave one example that is ,
CREATE VIEW vwProducts AS
SELECT productCode,
productName,
buyPrice
FROM products
WHERE buyPrice > (
SELECT AVG (buyPrice)
FROM products
)
ORDER BY buyPrice DESC
Tell me , is it possible ,
in view shall we use sub query or not ,
seems to be working in
5.0.27, what is your version?A view can be created from many kinds of SELECT statements. It can refer to base tables or other views. It can use joins, UNION, and subqueries. The SELECT need not even refer to any tables. The following example defines a view that selects two columns from another table, as well as an expression calculated from those columns:— http://dev.mysql.com/doc/refman/5.0/en/create-view.html