Folks:We have a master table (#tblGrpMaster) where we store the group access for each folder. At the end of each month we get data from other department regarding the actual access they have in each folder and the folder names are different. We then have to match the access against master table (#tblGrpMaster) and flag the differences. The data in master table is accurate. I would like help on the SQL statement. Here is the DDL and sample data. In the below example I have purposely added 2 records at the end which are not matching.CREATE TABLE #tblGrpMaster( FldrName VARCHAR(50), SecGroup VARCHAR(100), Access VARCHAR(20)) INSERT INTO #tblGrpMaster values ('Customer','Admin','Modify')INSERT INTO #tblGrpMaster values ('Customer','DatabaseAdmin','Modify')INSERT INTO #tblGrpMaster values ('Customer','Accounts','Read')INSERT INTO #tblGrpMaster values ('Customer','Clients','Read')INSERT INTO #tblGrpMaster values ('Customer','Documents','Modify')CREATE TABLE #tblAccess( ClientFldr VARCHAR(50), FldrName VARCHAR(50), SecGroup VARCHAR(100), Access VARCHAR(20))INSERT INTO #tblAccess values ('ABC','AbcReturs','Admin','Modify')INSERT INTO #tblAccess values ('ABC','AbcReturs','DatabaseAdmin','Modify')INSERT INTO #tblAccess values ('ABC','AbcReturs','Accounts','Read')INSERT INTO #tblAccess values ('ABC','AbcReturs','Clients','Read')INSERT INTO #tblAccess values ('ABC','AbcReturs','Documents','Modify')INSERT INTO #tblAccess values ('XYZ','ResiReturns','Admin','Modify')INSERT INTO #tblAccess values ('XYZ','ResiReturns','DatabaseAdmin','Modify')INSERT INTO #tblAccess values ('XYZ','ResiReturns','Accounts','Read')INSERT INTO #tblAccess values ('XYZ','ResiReturns','Clients','Read')INSERT INTO #tblAccess values ('XYZ','ResiReturns','Documents','Modify')INSERT INTO #tblAccess values ('XYZ','TrdReturns','Admin','Modify')INSERT INTO #tblAccess values ('XYZ','TrdReturns','DatabaseAdmin','Modify')INSERT INTO #tblAccess values ('XYZ','TrdReturns','Accounts','Read')INSERT INTO #tblAccess values ('XYZ','TrdReturns','Clients','Read')INSERT INTO #tblAccess values ('XYZ','TrdReturns','Documents','Modify')INSERT INTO #tblAccess values ('PQR','Lords','Admin','Modify')INSERT INTO #tblAccess values ('PQR','Lords','DatabaseAdmin','Modify')INSERT INTO #tblAccess values ('PQR','Lords','Accounts','Read')INSERT INTO #tblAccess values ('PQR','Lords','Clients','Modify') ---INSERT INTO #tblAccess values ('PQR','Lords','Documents','Read') ---INSERT INTO #tblAccess values ('PQR','Lords','Correspondence','Modify') ---
The Output should be:PQR - Lords - Clients - Modify - MISMATCH PQR - Lords - Documents - Read - MISMATCHPQR - Lords - Correspondence - Modify - MISMATCH (Does not exist in master table)Thanks !