sql server - SQL query IF EXISTS -
i want check data exists in table.. my table structure create table [dbo].[indicatordata] ( [id] [bigint] identity(1,1) not null, [value] [float] not null, [indicatorid] [int] not null, [source] [nvarchar](500) not null, [uploaded] [bit] not null, [createdby] [nvarchar](500) null, [createdon] [datetime] null, [lastmodifiedby] [nvarchar](500) null, [lastmodifiedon] [datetime] null ) table 2 create table [dbo].[datafields] ( [dataid] [bigint] not null, [fieldid] [int] not null ) indicatordata.id has relationship datafields.dataid ( indicatordata.id can have multiple combination of datafield) table indicatordata sample data: table datafields sample data: query tried: note : won't pass dataid, pass field id & indicatorid scenario #1 select * indicatordata inner join datafields b on a.id = b.dataid a.indicatorid = 72 , b.fieldid in (59, 207) when pass field id, need combination of values datai