Results 1 to 8 of 8
  1. #1
    Paolo is offline Novice
    Windows 11 Access 2016
    Join Date
    Apr 2023
    Posts
    5

    La query restituisce valori duplicati

    Buongiorno a Tutti e Auguri di Buona Pasqua.
    Premetto che sono nuovo del Forum e totalmente inesperto di Access.
    Mi permetto di chiedere il Vostro aiuto in merito ad un problema per me irrisolvibile.
    Spiego!
    Allora ho 3 tabelle


    "Anagrafica" con IdCodAzienda
    "Pozzi" collegata ad Anagrafica con relazione 1 a molti
    "Voltura" Collegata anch'essa ad Anagrafica 1 a molti
    Ho creato una query in cui ho richiamato i dati da tutte e 3 le tabelle.
    Nel risultato della query però mi appaiono record duplicati.
    Questi record sono riferiti ad una sola Azienda che ha 2 Pozzi (quindi nella tabella pozzi ho inserito 2 record) con dati differenti naturalmente.
    Quando eseguo la query i record dell'Azienda (con 2 Pozzi") diventano 4.
    Ho letto ed ho provato a cambiare il tipo di Join ma invano.
    Mi potreste aiutare a superare questo "inghippo"?
    Grazie

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    No comprende. Lo siento.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    Paolo is offline Novice
    Windows 11 Access 2016
    Join Date
    Apr 2023
    Posts
    5
    [QUOTE=Welshgasman;510612] Non comprende. Lo sento. [/CITAZIONE]
    Non mi sono spiegato bene?

  4. #4
    Paolo is offline Novice
    Windows 11 Access 2016
    Join Date
    Apr 2023
    Posts
    5
    In poche parole ho fatto una query con 3 tabelle.
    quando la eseguo tra i risultati vedo record doppi per lo stesso record
    Ho inserito 2 record ma la query me ne fa vedere 4

  5. #5
    Paolo is offline Novice
    Windows 11 Access 2016
    Join Date
    Apr 2023
    Posts
    5
    Intanto grazie per avermi risposto

  6. #6
    Join Date
    May 2018
    Location
    Living in Scotland UK
    Posts
    1,566
    A query will always display data from the Main Table and also the multiple related records from the related tables.

    This results in duplicate data being displayed.

    To display the data as you would like it you need to create a Report based on the query.
    You can PM me if you need further help.
    Good Reading https://docs.microsoft.com/en-gb/off...on-description

  7. #7
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    Try setting Unique values =Yes to eliminate duplicates.
    Or using query SQL, change SELECT to SELECT DISTINCT.
    However doing that will make your query read only
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  8. #8
    Paolo is offline Novice
    Windows 11 Access 2016
    Join Date
    Apr 2023
    Posts
    5
    Quote Originally Posted by isladogs View Post
    Prova a impostare Valori unici =Sì per eliminare i duplicati.
    Oppure utilizzando query SQL, modificare SELECT in SELECT DISTINCT.
    tuttavia, ciò renderà la tua query di sola lettura
    Intanto grazie a tutti
    Che la query restituisce i record della tabella principale lo so. La questione è che i duplicati sono record che scaturiscono da dati inseriti una sola volta ed in un solo record.... di record multipli non ne ho inseriti.
    Devo provare a modificare in SELECT DISTINCT
    Ho letto anche di inserire nella query a clausola WHARE ...... ma a sapere come si fa.
    Comunque proverò con SELECT DISTINCT

Please reply to this thread with any new information or opinions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums