Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6919027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:56:11+00:00 2026-05-27T09:56:11+00:00

I have a table with five fields, | Zip code | Data 1 |

  • 0

I have a table with five fields,

| Zip code | Data 1 | Data 2 | Data 3 | Code |

my table and its data below i have tones of records like this so there are many duplicate data for fields [data 1], [data2] and [data 3]

 Zip | Data 1 | Data 2 | Data 3 | Code |
 123 | __A__ |__ B__ |__ C__ |_____ |
 234 | __A__ |__ B__ |__ C__ |_____ |
 456 | __A__ |__ B__ |______ |_____ |
 678 | __A__ |__ B__ |__ C__ |_____ |
 981 | __A__ |__ B__ |______ |_____ |

my goal is to find the matching row values so i have a set of unique row from them (which i created by a query this gave me )

| Data 1 | Data 2 | Data 3 | Code |
| __A__ |__ B__ |__ C__ |_____ |
| __A__ |__ B__ |______ |_____ |

What i wanted to do with this was just enter a code value in that query so it reflects on the existing table and displays the code in all duplicate values ,

so say i enter this data in the query,( which i cannot enter for some reason )

| Data 1 | Data 2 | Data 3 | Code |
| __A__ |__ B__ |__ C__ |__C1__ |
| __A__ |__ B__ |______ |__C2__ |

i want the following output in the table

Zip | Data 1 | Data 2 | Data 3 | Code |
123 | __A__ |__ B__ |__ C__ |__C1__ |
234 | __A__ |__ B__ |__ C__ |__C1__ |
456 | __A__ |__ B__ |______ |__C2__ |
678 | __A__ |__ B__ |__ C__ |__C1__ |
981 | __A__ |__ B__ |______ |__C2__ |

How can i do this ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:56:12+00:00Added an answer on May 27, 2026 at 9:56 am

    First, select your distinct values and insert them into a temporary table or scratch table:

    TempTable
    Data1
    Data2
    Data3
    Code null
    

    Next, insert distinct rows into your table

    insert into TempTable (Data1, Data2, Data3)
    select distinct data1, data2, data3 from myTable
    

    Next, update your temp table with whatever code you want for each record. Still not sure if you have a specific value in mind or if you want it to be just a “unique” value. If a unique value, you could set code to be an identity and skip this step

    update temptable set Code = '' where Data1 = x and Data2 = y and Data3 = z
    

    Lastly, update your original table with the values

    update myTable
    inner join tempTable 
       on [myTable].data1 = [tempTable].data1 
          and [myTable].data2 = [tempTable].data2 
          and [myTable].data3 = [tempTable].data3
      set [myTable].Code = [tempTable].Code;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have table with some fields that the value will be 1 0. This
I have a form where five fields are there but when i click on
I have a table with data : id one two three four five six
I have these four table assume that ring table consist of five fields(jewelry_id,ring_id,image,type,brand_id) Note
Let's say I have table with column 'URL' whrere I store urls like this
I have a large table I imported from an Excel spreadsheet. For five of
I have the following five tables: ISP Product Connection AddOn AddOn/Product (pivot table for
I have table with 50 entries (users with such details like Name Surname Location
I have table rows of data in html being filled from a CGI application.
I have a simple mysql table with five columns: id: auto_increment (primary) id_symbol: INT(4)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.