今古: You are definitely a SQL guru!!!! By the way, have you tested the SQL statement? If, on Oracle, SQL Server, MySQL etc? Thanks.