• I'm not completely clear what you're doing. Do you mean you have a _key_out field in every table in the DB?

    Are you trying to get

    select count( distinct _key_out) from table1