Hi! I have two database. I want check and get data from it.
I have two database. Users into model and stp_values into msdb. I want inner join between two database tables.
USE [model]
GO
/****** Object: Table [dbo].[stp_values] Script Date: 09/26/2018 16:23:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[users](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Log] [nchar](20) NOT NULL,
[Pass] [nchar](50) NOT NULL,
[DocId] [int] NOT NULL
) ON [PRIMARY]
GO
USE [msdb]
GO
/****** Object: Table [dbo].[stp_values] Script Date: 09/26/2018 16:23:00 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[stp_values](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Log] [nchar](20) NOT NULL,
[Pass] [nchar](50) NOT NULL,
[DocId] [int] NOT NULL
) ON [PRIMARY]
GO
select u.Log, u.Pass, u.docid
from [model].[dbo].[users] u
inner join [msdb].[dbo].[stp_values] s on u.docid = s.docid
where u.log = 'mti' and u.pass = '12345' and s.log = 'mti' and s.pass = '12345'