What are the distinct template type descriptions for the templates ever used by any document?
create table templates (template_type_code varchar, template_id varchar, PRIMARY KEY (template_type_code)); create table documents (template_id varchar, PRIMARY KEY (template_id)); create table ref_template_types (template_type_description varchar, template_type_code varchar, PRIMARY KEY (template_type_description))
select distinct t1.template_type_description from ref_template_types as t1 join templates as t2 on t1.template_type_code = t2.template_type_code join documents as t3 on t2.template_id = t3.template_id