none
MS access SQL query RRS feed

  • Question

  • I have table like below which is ID and Customer name. I want to update each unique ID UNKNOWN value with the name with respect to the name which is A or B if that case is under each unique ID only one unique name exists. 

    ID Cust Name
    1 A
    1 UNKNOWN
    1 UNKNOWN
    2 B
    2 UNKNOWN
    3 C
    3 UNKNOWN
    3 C
    3 C
    3 UNKNOWN
    4 D
    4 UNKNOWN
    5 E
    5 UNKNOWN
    6 F
    6 F
    6 F
    7 UNKNOWN
    8 H
    8 UNKNOWN

    Thursday, June 27, 2019 8:51 AM

All replies

  • Can you provide us with 2 examples, (1) your current data, (2) the desired final data.

    Daniel Pineault, 2010-2018 Microsoft MVP
    Professional Support: http://www.cardaconsultants.com
    MS Access Tips and Code Samples: http://www.devhut.net

    Thursday, June 27, 2019 1:12 PM
  • Current data as follows: ID and Cust Name for example for the ID 1 there is one cust name and other two lines are UNKOWN. So, for each unique ID and under that if the customer name is only one unique name then it should replace with that customer name.

    ID Cust Name
    1 A
    1 UNKNOWN
    1 UNKNOWN
    2 B
    2 BB
    2 UNKNOWN
    3 C
    3 UNKNOWN
    3 C
    3 C
    3 UNKNOWN
    4 D
    4 UNKNOWN



    For Example: Down below is the desired output and logic should apply all those rows except ID 2 that's because under each unique ID there are two customer name. so can't replace. only one customer name should beassociated with that deal.

    ID Cust Name
    1 A
    1 A
    1 A
    2 B
    2 UNKNOWN
    2 BB
    3 C
    3 C
    3 C
    3 C
    3 C
    4 D
    4 D

    Thursday, June 27, 2019 3:21 PM