Selecting Rows Through a View
From InterBase
Go Up to Selecting Multiple Rows
To select a subset of rows available through a view, substitute the name of the view for a table name in the FROM
clause of a SELECT
. For example, the following cursor produces a list of employee phone numbers based on the PHONE_VIEW
view:
EXEC SQL DECLARE PHONE_LIST CURSOR FOR SELECT FIRST_NAME, LAST_NAME, PHONE_EXT FROM PHONE_VIEW WHERE EMPLOYEE.DEPT_NO = DEPARTMENT.DEPT_NO;
A view can be a join. Views can also be used in joins, themselves, in place of tables. For more information about views in joins, see Joining Tables.