Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: Select Distinct

  1. #1
    Join Date
    Feb 2011
    Posts
    240

    Default Select Distinct

    Hi,

    When I use in the SQL query of table input a SELECT SQL, and I click on Preview, takes a long time to display data, and after some crashes spoon. The same thing happens when I click on Run in "table output".

    There is an alternative way?

    Thanks

    Mariarita

  2. #2
    Join Date
    Feb 2011
    Posts
    240

    Default

    Can you help me please?

    Thanks
    Mariarita

  3. #3
    Join Date
    Feb 2009
    Posts
    321

    Default

    mariarita, the sql sentences must be not ok, please check the sql senteces with an "sql developer" or another tool of sql, this is not an error from table input or table output

  4. #4
    Join Date
    Feb 2011
    Posts
    240

    Default

    Hi,
    The query is this:


    select distinct

    cartella.n_cartella as "cartella",
    substr(trim(cartella.cognome)||' '||trim(cartella.nome),1,40) as "cognome_nome",
    cartella.data_nasc as "data_nascita",
    cartella_eta.eta,
    cartella.sesso,
    cartella.cod_com_nasc as "cod_comune_nascita",
    comuni.descrizione as "comune_nascita",
    cartella.cittadinanza as "cod_cittadinanza",
    cittadin.des_cittadin as "cittadinanza",
    substr(cittadin.flag_cittadin,1,1) as "ue_extraue",
    cartella.cod_reg as "codice_sanitario",
    cartella.cod_fisc as "codice_fiscale",
    cartella.cod_usl as "codice_usl",
    cartella.data_apertura,
    cartella.data_chiusura,
    trim(tab_voci.tab_descrizione) as "motivo_chiusura",
    anagra_c.citta as "cod_comune_res",
    comuni_res.descrizione as "comune_res",
    anagra_c.indirizzo as "indirizzo_res",
    areadis_res.descrizione as "areadis_res",
    anagra_c.dom_citta as "cod_comune_dom",
    comuni_dom.descrizione as "comune_dom",
    anagra_c.dom_indiriz as "indirizzo_dom",
    areadis_dom.descrizione as "areadis_dom",
    zone.descrizione_zona as "zona",
    distretti.des_distr as "distretto",
    anagra_c.cod_med as "cod_mmg",
    substr(trim(medici.mecogn)||' '||medici.menome,1,40) as "mmg",
    medici.mefisc as "cod_fisc_mmg",
    region.region as "regione",
    tabusl.desusl as "usl_residenza"

    from
    sinsnt_test.cartella,
    sinsnt_test.comuni,
    sinsnt_test.comuni comuni_res,
    sinsnt_test.comuni comuni_dom,
    sinsnt_test.cittadin,
    sinsnt_test.tab_voci,
    sinsnt_test.anagra_c,
    sinsnt_test.areadis areadis_res,
    sinsnt_test.areadis areadis_dom,
    sinsnt_test.medici,
    sinsnt_test.region,
    sinsnt_test.zone,
    sinsnt_test.distretti,
    sinsnt_test.tabusl,
    sinsnt_test.cartella_eta

    where cod_com_nasc = comuni.codice
    and cittadinanza = cittadin.cd_cittadin
    and ('MOTCHI'= tab_voci.tab_cod
    and cartella.motivo_chiusura=tab_voci.tab_val)
    and cartella.n_cartella = anagra_c.n_cartella
    and anagra_c.data_variazione =
    (select max(data_variazione) from sinsnt_test.anagra_c
    where cartella.n_cartella = anagra_c.n_cartella)
    and anagra_c.citta = comuni_res.codice
    and anagra_c.dom_citta = comuni_dom.codice
    and anagra_c.areadis = areadis_res.codice
    and anagra_c.dom_areadis = areadis_dom.codice
    and anagra_c.cod_med = medici.mecodi
    and anagra_c.regione = region.cd_reg
    and (anagra_c.regione||anagra_c.usl) = tabusl.cd_usl
    and areadis_dom.cod_distretto = distretti.cod_distr
    and distretti.cod_zona = zone.codice_zona

    Are there errors?

    Thanks
    Mariarita

  5. #5
    Join Date
    Dec 2009
    Posts
    609

    Default

    Hi,

    your SQL statement is missing some join-conditions...
    Check your statement.

    Cheers,

    Tom

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.