do you mean create a view in database A that queries from database B? if they are on the same server it's easy, just use 3 part names:
create view dbo.MyView as select blah from B.dbo.tableInB
if they A and B are on different servers, then you need to create a linked server on serverA to serverB, and then use 4 part names:
create view dbo.MyView as select blah from ServerB.B.dbo.tableInB