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

  • Home
  • SEARCH
  • 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 987277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:27:10+00:00 2026-05-16T05:27:10+00:00

I have a table that allows records to be inserted which are very similar

  • 0

I have a table that allows records to be inserted which are very similar but differ by a single column value or two. For example the following records are in the table:

ID    TITLE                                 URL                             COUNTRY

1494  Hollywood Reporter                    http://www.hollywoodreporter.com    USA
1497  Hollywood Reporter via Drudge Report  http://www.hollywoodreporter.com    NULL
2158  Hollywood Reporter via                http://www.hollywoodreporter.com    NULL

I would like to update the country column in the last two records where the url is the same.
Also I would also like to know how to sort my table by url column so that all duplicate urls are grouped together or even if they are similar as you have in some cases like:

http://www.hollywoodreporter.com       http://www.blog.hollywoodreporter.com

Thanks in advance.

Tried the following and it worked where the urls were the same

UPDATE t1

SET t1.country = t2.country
FROM Sources AS t1
JOIN sources AS t2
ON t1.url = t2.url
WHERE t1.url= t2.url;

just got to figure out the rest. thanks everyone


UPDATE

I was able to edit the records that had matching urls but for the ones that are similar like
http://www.pantagraph.com
http://pantagraph.com
http://pantagraph.com/titles

were not updated. When using the sort and select I can view all these records but when trying to update them it does not work. I even just tried this simple version of:

 select * from Sources s
 where s.url like url 

which shows the records but when updating it did not work.

update Sources 
set country = s.country 
from Sources s 
 where s.url like url
  • 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-16T05:27:11+00:00Added an answer on May 16, 2026 at 5:27 am

    You could use a subquery:

    update  yt
    set     country = (
                      select  distinct country 
                      from    YourTable yt2 
                      where   yt.url = yt2.url 
                              and yt2.country is not null
                      )
    from    YourTable yt
    

    This should give an error if there is an URL with different countries: in that case you should adapt the query to choose one of the countries.

    Per your comment, to find rows with conflicting countries:

    select  url
    ,       count(distinct country) as NumberOfCountries
    from    YourTable
    where   country is not null
    group by
            url
    ,       country
    having  count(distinct country) > 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a multi column datastore on a table that allows me to
I already have 80 million records inserted into a table, but need to ensure
I have a table that records a sequence of actions with a field that
I have a very high-traffic table with a char(50) field which takes part in
I have a database table that i want to allow my friends to update.
I have a table that got into the db_owner schema, and I need it
I have a table that contains tasks and I want to give these an
I have a table that has redundant data and I'm trying to identify all
I have a table that is created in a DataList in ASP.Net. This table
I have a table that holds information about cities in a game, you can

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.