[Solved] Select Statement on Two different views


Yes, You can use two different view in SELECT query. You have to JOIN them, if them have matched column in each other.

Just treat two different views as like two different tables when using in SELECT Clause.

SELECT vw1.a, vw2.b
FROM View1 vw1 INNER JOIN View2 vw2
     ON vw1.id = vw2.id

For Clarification, A view can be thought of as either a virtual table or a stored query. A user can use this virtual table by referencing the view name in Transact-SQL statements the same way a table is referenced.

EDIT

Select vw1.username, vw2.usertype 
From vw1 INNER JOIN vw2 
         ON vw1.colID = vw2.colID  <<<< Here you have to use 
                                   <<<< common column between two views to matched rows

7

solved Select Statement on Two different views