• Here are the other 2 tables

    You need to test the code you post. The idea here is for me to be able to recreate your tables on my system. This has lots of errors.

    I removed all the foreign keys and it will at least create the tables.

    CREATE TABLE [dbo].[proposals](

    [UniqueID] [int] IDENTITY(1000,1) NOT NULL,

    [PropID] [int] NOT NULL,

    [Rev] [int] NOT NULL,

    [FRID] [int] NOT NULL,

    [NatFRID] [int] NOT NULL,

    [us] [bit] NOT NULL,

    [ActiveRev] [bit] NOT NULL,

    [COID] [int] NOT NULL,

    [BillToCOID] [int] NOT NULL,

    [CPID] [int] NOT NULL,

    [LeadID] [int] NOT NULL,

    [ProjID] [int] NOT NULL,

    [LgID] [int] NOT NULL,

    [SalesEng] [int] NOT NULL,

    [title] [nvarchar](100) NOT NULL,

    [status] [int] NOT NULL,

    [created] [datetime] NOT NULL,

    [resolution] [int] NOT NULL,

    [resolutiondt] [date] NULL,

    [resolvedby] [int] NOT NULL,

    [PMappDt] [date] NULL,

    [PMappLgID] [int] NOT NULL,

    [CustAppDt] [date] NULL,

    [CustAppLgID] [int] NOT NULL,

    [CustAppCPID] [int] NOT NULL,

    [FinAppDt] [datetime] NULL,

    [FinAppLgID] [int] NOT NULL,

    [SalesTax] [int] NOT NULL,

    [CustPO] [nvarchar](50) NULL,

    [PricingMethod] [int] NOT NULL,

    [TaxMethod] [tinyint] NOT NULL,

    [PaymentTerms] [int] NOT NULL,

    [TermsConds] [int] NOT NULL,

    [PCClevel] [int] NOT NULL,

    [ProjCloseDt] [date] NULL,

    [ProjCompDt] [date] NULL,

    [SpecConds] [int] NOT NULL,

    [ProjContact] [int] NOT NULL,

    [MasterPermit] [nvarchar](50) NULL,

    [ElectricPermit] [nvarchar](50) NULL,

    [folio] [nvarchar](100) NULL,

    [legal] [nvarchar](1000) NULL,

    [OneTime] [decimal](10, 2) NULL,

    [AdjRsn] [int] NOT NULL,

    [dirtyPrice] [bit] NOT NULL,

    [recentPrice] [decimal](10, 2) NULL,

    [recentPandM] [decimal](10, 2) NULL,

    [recentLabor] [decimal](10, 2) NULL,

    [recentOther] [decimal](10, 2) NULL,

    [ptDetail] [nvarchar](1000) NULL,

    [isTemplate] [bit] NOT NULL,

    [SysList] [nvarchar](100) NULL,

    [rollups] [char](14) NOT NULL,

    [prefs] [nvarchar](50) NULL,

    [template] [int] NOT NULL,

    [message] [nvarchar](100) NULL,

    [POnotes] [nvarchar](1000) NULL,

    CONSTRAINT [PK_proposals] PRIMARY KEY CLUSTERED

    (

    [UniqueID] ASC

    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],

    CONSTRAINT [UK_proposals] UNIQUE NONCLUSTERED

    (

    [PropID] ASC,

    [Rev] ASC,

    [FRID] ASC

    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

    ) ON [PRIMARY]

    GO

    CREATE TABLE [dbo].[logins](

    [LgID] [int] IDENTITY(1,1) NOT NULL,

    [FRID] [int] NOT NULL,

    [BRID] [int] NOT NULL,

    [firstname] [nvarchar](60) NOT NULL,

    [lastname] [nvarchar](60) NOT NULL,

    [jobtitle] [nvarchar](50) NOT NULL,

    [nvarchar](128) NOT NULL,

    [office] [nvarchar](50) NOT NULL,

    [cellphone] [nvarchar](50) NOT NULL,

    [hidecell] [bit] NOT NULL,

    [noDirectory] [bit] NOT NULL,

    [username] [nvarchar](128) NOT NULL,

    [password] [nvarchar](128) NOT NULL,

    [admin] [tinyint] NOT NULL,

    [owner] [bit] NOT NULL,

    [lockoutct1] [tinyint] NOT NULL,

    [lockoutct2] [tinyint] NOT NULL,

    [remlogin] [bit] NOT NULL,

    [inactive] [bit] NOT NULL,

    [appLimit] [int] NOT NULL,

    [svcLimit] [int] NOT NULL,

    [PropPrefs] [nvarchar](50) NULL,

    [coRollups] [char](14) NULL,

    [propMessage] [nvarchar](100) NULL,

    [dailyemail] [nvarchar](128) NULL,

    [FwdEmail] [int] NOT NULL,

    [mustChgPW] [bit] NOT NULL,

    [BBtoken] [nvarchar](50) NULL,

    [mailBox] [bit] NOT NULL,

    [statusDt] [datetime] NULL,

    [status] [nvarchar](100) NULL,

    [helpdesk] [bit] NOT NULL,

    [birthmonth] [tinyint] NOT NULL,

    [birthday] [tinyint] NOT NULL,

    [HomePhone] [nvarchar](50) NULL,

    [HomeAdd] [nvarchar](300) NULL,

    [PayPeriod] [tinyint] NOT NULL,

    [ComDeal] [int] NOT NULL,

    [OvrDeal] [int] NOT NULL,

    [BoxDeal] [int] NOT NULL,

    [BoxOvr] [int] NOT NULL,

    [SvcDeal] [int] NOT NULL,

    [SvcOvr] [int] NOT NULL,

    [Exempt] [bit] NOT NULL,

    [Boss] [int] NOT NULL,

    [EmpNo] [nvarchar](50) NULL,

    [Rate] [decimal](8, 2) NOT NULL,

    [HWM] [tinyint] NOT NULL,

    [HireDate] [datetime] NULL,

    [LastRev] [datetime] NULL,

    [NextRev] [datetime] NULL,

    [lastView] [int] NOT NULL,

    [lastFilterType] [tinyint] NOT NULL,

    [lastFilterRec] [int] NOT NULL,

    [ipaddress] [nvarchar](24) NULL,

    CONSTRAINT [PK_logins] PRIMARY KEY CLUSTERED

    (

    [LgID] ASC

    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],

    CONSTRAINT [UK_logins_username] UNIQUE NONCLUSTERED

    (

    [username] ASC

    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

    ) ON [PRIMARY]

    GO

    CREATE TABLE [dbo].[ProposalProfitSplitWorksheet](

    [WorksheetID] [int] IDENTITY(1,1) NOT NULL,

    [DateTimeCreated] [datetime] NOT NULL,

    [CreatedByUserID] [int] NOT NULL,

    [CreatedByImpersonatingUserID] [int] NULL,

    [ProposalUniqueID] [int] NOT NULL,

    [ScenarioNumber] [int] NOT NULL,

    [BillingBranchID] [int] NOT NULL,

    [SiteSurveyBranchID] [int] NOT NULL,

    [DateTimeAcceptedBySellingBranch] [datetime] NULL,

    [AcceptedBySellingBranchUserID] [int] NULL,

    [AcceptedBySellingBranchImpersonatingUserID] [int] NULL,

    [DateTimeAcceptedByInstallingBranch] [datetime] NULL,

    [AcceptedByInstallingBranchUserID] [int] NULL,

    [AcceptedByInstallingBranchImpersonatingUserID] [int] NULL,

    CONSTRAINT [PK_ProposalProfitSplitWorksheet] PRIMARY KEY CLUSTERED

    (

    [WorksheetID] ASC

    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]

    ) ON [PRIMARY]

    GO

    So now we have the tables. We still need a few rows of sample to do much here. If I understand correctly you want to make sure you have row in both proposals and logins with a matching FRID? Is there some way to know which row(s) in that table you are interested in? Maybe also LgID must match? I am not quite sure what the business rule is here.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/