Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Search Query

Search Query

Scheduled Pinned Locked Moved Database
questiondatabase
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mehrdadc48
    wrote on last edited by
    #1

    Hi, I have a Address field.I want to make a query that returns all records that their addresses contain all words of a address in any order. Suppose 'John street , No 2' is the address, I want to return all addresses that contains 'John' , 'street', 'No' and '2' in any order. How can I make this query? Original string : My name is Mehrdad

    Best wishes

    M B 2 Replies Last reply
    0
    • M mehrdadc48

      Hi, I have a Address field.I want to make a query that returns all records that their addresses contain all words of a address in any order. Suppose 'John street , No 2' is the address, I want to return all addresses that contains 'John' , 'street', 'No' and '2' in any order. How can I make this query? Original string : My name is Mehrdad

      Best wishes

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      Use and with like

      SELECT *
      FROM Somehwere
      WHERE address1 LIKE '%John%'
      AND address1 LIKE '%Street%'
      AND address1 LIKE '%No%'

      However this is not going to help where you have St instead of Street ,Rd instead of Road and many many more issues that arise from cleaning address data.

      Never underestimate the power of human stupidity RAH

      1 Reply Last reply
      0
      • M mehrdadc48

        Hi, I have a Address field.I want to make a query that returns all records that their addresses contain all words of a address in any order. Suppose 'John street , No 2' is the address, I want to return all addresses that contains 'John' , 'street', 'No' and '2' in any order. How can I make this query? Original string : My name is Mehrdad

        Best wishes

        B Offline
        B Offline
        Blue_Boy
        wrote on last edited by
        #3

        You can use SOUNDEX[^]


        I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.aktualiteti.com

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups