Use correct table alias in the where clause