--
-- Type: VIEW; Owner: BIOMART; Name: CTD_TD_SMOKER_VIEW
--
  CREATE OR REPLACE FORCE VIEW "BIOMART"."CTD_TD_SMOKER_VIEW" ("ID", "REF_ARTICLE_PROTOCOL_ID", "TRIAL_SMOKERS_PCT", "TRIAL_FORMER_SMOKERS_PCT", "TRIAL_NEVER_SMOKERS_PCT", "TRIAL_PACK_YEARS") AS 
  select rownum as ID, v."REF_ARTICLE_PROTOCOL_ID",v."TRIAL_SMOKERS_PCT",v."TRIAL_FORMER_SMOKERS_PCT",v."TRIAL_NEVER_SMOKERS_PCT",v."TRIAL_PACK_YEARS"
 from (
 select distinct REF_ARTICLE_PROTOCOL_ID,
       TRIAL_SMOKERS_PCT,
       TRIAL_FORMER_SMOKERS_PCT,
       TRIAL_NEVER_SMOKERS_PCT,
       TRIAL_PACK_YEARS	
 from ctd_full
 where TRIAL_SMOKERS_PCT is not null or TRIAL_NEVER_SMOKERS_PCT is not null
 order by REF_ARTICLE_PROTOCOL_ID, TRIAL_SMOKERS_PCT
 ) v





;
 
