sd_dracula sd_dracula - 2 months ago 9
SQL Question

sql selecting from view and table

I have a select query in which I would like to do a join on a view and another table.
The view works fine and so does the table, separately. But when I try to do something like:

select VIEW.col1, VIEW.col2
from VIEW, TABLE
where VIEW.col1 = TABLE.col1


I get
The multi-part identifier "VIEW.col1" could not be bound.


Is the syntax wrong, or is that just not allowed on views?

Answer

This should work

select v.col1, t.col2
from VIEW v, TABLE t
where v.col1 = t.col1