I have two azure databases say DB1 and DB2. DB1 has got few tables and I want to create stored procedure in DB2 to cross query with joins in the tables in DB1. I have seen examples with Cross Database query but mostly showing only single table. My Stored procedure is like:
select
u.UserID as [UserID],
u.Username as [UserName],
u.LastLoginDate,
ISNULL(au.IsDeleted, 1) as [IsDeleted]
from DB1.[sec].[User] u
join DB1.[sec].[AppUser] au on (u.UserID = au.UserID)
join DB1.[sec].[Application] a on (au.ApplicationID = a.ApplicationID)
where (a.Name = 'name')