请问查询视图会造成二次查询吗
视图:
SELECT a.Id,b.Name FROM table AS a INNER JOIN table1 AS b ON a.Id=b.Id
查询:
SELCT * FROM 视图 WHERE Id = 5
请问这个查询等同于
SELCT * FROM
(SELECT a.Id,b.Name FROM table AS a INNER JOIN table1 AS b ON a.Id=b.Id)
WHERE Id = 5
还是说等同于
SELECT a.Id,b.Name FROM table AS a INNER JOIN table1 AS b ON a.Id=b.Id WHERE a.Id = 5
------解决方案--------------------SELCT * FROM
(SELECT a.Id,b.Name FROM table AS a INNER JOIN table1 AS b ON a.Id=b.Id)
WHERE Id = 5
和
SELECT a.Id,b.Name FROM table AS a INNER JOIN table1 AS b ON a.Id=b.Id WHERE a.Id = 5
完全一样。
------解决方案--------------------看执行计划.