You guys are very close. We set up customers like this
c1007 Construction Company#1 Invoice Date 10/1/2015
c1007-1 Construction Company#1 first job Invoice Date 10/2/15
c1007-2 Construction Company#2 second job Invoice Date 9/30/2015
So I need the most recent document date for c1007 and his jobs (consolidated BP) which in the above case would be from BP c1007-1 10/2/15
So I need to change the portion of the query "WHERE CardCode = TO.CardCode to a LIKE statement, but I am failing to get the exact syntax of the LIKE statement