If you post the data in a consumable format (i.e., something that one can copy and paste to an SSMS window to create test table and data and run queries against that), that makes it easy for someone to write a query and test. Without that a lot of time and efforts on the part of the person who wants to respond is required to create the data. I have created the consumable test data for you. I have to do some real work now, and haven't had a chance to read carefully enough to understand the problem you are trying to solve. So hopefully someone else will post a solution; if not I can give it a try when I come back.-- CONSUMABLE SAMPLE DATACREATE TABLE #Geology(HoleId VARCHAR(32), FromDepth FLOAT, ToDepth FLOAT, RockType VARCHAR(32));CREATE TABLE #Assay(HoleId VARCHAR(32), FromDepth FLOAT, ToDepth FLOAT, Grade INT);INSERT INTO #Geology VALUES('DH001','0','0.3','Sandstone'),('DH001','0.3','1.2','Shale'),('DH001','1.2','3.3','Sandstone'),('DH001','3.3','4.0','Limestone')INSERT INTO #Assay VALUES('DH001','0','0.5','630'),('DH001','0.5','1.0','520'),('DH001','1.0','2.0','340'),('DH001','2.0','3.0','160'),('DH001','3.0','4.0','180');