I'm trying to come up with an automated solution for something I do manually now and I only have minimal, bare-bones SQL skill. I usually modify simple queries others have built or will build basic select queries. I have done some reading but don't know how to make it do what I need in this case. I need to come up with something others can use while I am out for a month (and which will save me time when I return).

What I need is to return the fields below where tblThree.EndDate is later than tblFive.ServiceEnd. I have to do a couple of other compares on the dates, but if I get a working query of the first one I can make it work with the others. We use MS SQL Server 2008.

I tried creating sub-queries with aliases and failed miserably at making it work.

These are the table and fields I am working with:

```
    tblOne.ServiceID
    tblOne.ServiceYear
    tblOne.Status
    tblTwo.AccountNbr
    tblTwo.AcctName
    tblThree.BeginDate (smalldatetime, null)
    tblThree.EndDate (smalldatetime, null)
    tblFour.ClientID
    tblFour.ServiceName
    tblFive.ContractID
    tblFive.ServiceBegin (smalldatetime, null)
    tblFive.ServiceEnd (smalldatetime, null)

```

This is how the tables are related:

```
    tblOne.ServiceID = tblThree.ServiceID
    tblOne.ContractID = tblFive.ContractID
    tblOne.ClientID = tblFour.ClientID
    tblTwo.AccountNbr = tblFour.Account

```

I used MS Access 2003 to generate the Join SQL:

```
SELECT  tblOne.ServiceID, tblTwo.AccountNbr,
    tblTwo.AcctName, tblFour.ServiceName, tblOne.Status,
    tblThree.BeginDate, tblThree.EndDate,
    tblOne.ServiceYear, tblFive.ServiceBegin,
    tblFive.ServiceEnd

FROM  ((tblTwo INNER JOIN tblFour 
  ON  tblTwo.AccountNbr=tblFour.AccountNbr) INNER JOIN (tblThree INNER JOIN tblOne 
  ON  tblThree.ServiceID=tblOne.ServiceID) 
  ON  tblFour.ClientID=tblOne.ClientID) INNER JOIN tblFive 
  ON  tblOne.ContractID=tblFive.ContractID;

```

Thanks for any help.