the where clause is using the table tblreferral, this table is not included as part of the FROM or inner join clause.
you cant refer to a table in the where clause that is not used in the from or inner join clause of the query
the From and Inner Join portion of the query tells the database what tables you are looking at the data for.