For mwill007: this response from haukex is exactly what I would have suggested (SQL::Abstract ).
In reply to Re^2: building sql statement by Your Mother in thread building sql statement by mwill007