Thanks for the reply, the debug code helped, it returned 18 so the WebAssist code is correct, I guess I just can't count the extra records using a left join, you were correct the main SQL code was wrong, I've corrected that now, thanks, the problem still exists with what I'm trying to do but I can settle by ordering by logs.id I have two log tables that I was trying to join together but could only join on id for both anything else I tried returned multiple records over and over again, so I joined on id and wanted to order by logs.date on the left table with the records being affected on the right, but having tried everything I don't think it's possible but id will do, many thanks for your help it was much appreciated