Managed to get my 7 hour query down to around 4 mins, many thanks.