$ 0 0 Ok thanks. I was trying to avoid rewriting the whole thing its 1000+ lines in a single select statement. Here goes...