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 986201
In Process

The Archive Base Latest Questions

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

Is there a way to search for fields that contain similar values in a

  • 0

Is there a way to search for fields that contain similar values in a sql db?
For example I have a table of over a million records where one column contains url values and is associated with a country column. Previously I tried to match urls that are equal where it contained a null value for the country as was able to update it using the following:

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

Then I altered the query to use the like word as follows:

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

when I just use the select statement to find the records where urls are like then I get the results but the update does not work.
A better example is as follows:

  • http://www.pantagraph.com
  • http://pantagraph.com
  • http://www.pantagraph.com/news

These are all the same domain url and I just want to update the country column for each one to avoid doing it manually because there are around 200000 to do.

  • 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:17:00+00:00Added an answer on May 16, 2026 at 5:17 am

    How about:

     UPDATE t1
     SET t1.country = t2.country
     FROM Sources AS t1
     JOIN sources AS t2
     ON t1.url LIKE t2.url
    

    See what kind of joins you get when you run that on your dataset…it may make too many bad matches.

    At some point you’ll probably need to do some matching based on exact portions of the url, but i don’t know how to do that in a query like this. See this links for info:

    http://www.w3schools.com/SQL/sql_wildcards.asp

    Oh and if all the URLs contain the http://www. portion you could always do something like

     WHERE left(t1.url,16) = left(t1.url,16)
    

    That might cut down on your execution time and enfore better joins

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table that contains, for example, two fields that I want to
Is there a way to search on www.qantas.com.au or other sites that don't use
Is there a way to search an XDocument without knowing the namespace? I have
I have a search form that allows users to search on several different fields
I have a subobject in a mongo database with fields that contain spaces, something
Is there a way to search the database if a column name / field
Is there a way to search for a file in a subversion repository? Something
Is there a way to search and eventually search and replace text in Visual
Is there a way to search, from a string, a line containing another string
Is there any way to search on a stream/feed for an item without authentication?

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.