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. Comparision in SQl Server

Comparision in SQl Server

Scheduled Pinned Locked Moved Database
databasesql-serversysadminregexhelp
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.
  • U Offline
    U Offline
    Uma Kameswari
    wrote on last edited by
    #1

    Hi, I have two tables A and B. A have a column col1 with list of values comma separated. B also has a column col2 with list of values comma separated. Now I should get records joining on both the columns where values in col1 = values in col2 all the values should match.How can I achieve this. For example. table A col1 delhi,chennai,kolkata,mumbai delhi,mumbai delhi,chennai table B col2 delhi,mumbai now i want to get all the records from table A where ever the column col1 has both delhi and mumbai this is my problem. Regards, Uma

    G G 2 Replies Last reply
    0
    • U Uma Kameswari

      Hi, I have two tables A and B. A have a column col1 with list of values comma separated. B also has a column col2 with list of values comma separated. Now I should get records joining on both the columns where values in col1 = values in col2 all the values should match.How can I achieve this. For example. table A col1 delhi,chennai,kolkata,mumbai delhi,mumbai delhi,chennai table B col2 delhi,mumbai now i want to get all the records from table A where ever the column col1 has both delhi and mumbai this is my problem. Regards, Uma

      G Offline
      G Offline
      gskumar111
      wrote on last edited by
      #2

      SELECT TABLEA.COL1,TABLEB.COL2 FROM TABLEA INNERJOIN TABLEB ON TABLEA.COL1 = TABLEB.COL2

      1 Reply Last reply
      0
      • U Uma Kameswari

        Hi, I have two tables A and B. A have a column col1 with list of values comma separated. B also has a column col2 with list of values comma separated. Now I should get records joining on both the columns where values in col1 = values in col2 all the values should match.How can I achieve this. For example. table A col1 delhi,chennai,kolkata,mumbai delhi,mumbai delhi,chennai table B col2 delhi,mumbai now i want to get all the records from table A where ever the column col1 has both delhi and mumbai this is my problem. Regards, Uma

        G Offline
        G Offline
        Girish481
        wrote on last edited by
        #3

        Try this: select b.col2 from tableA a,tableB b where BINARY_CHECKSUM(a.col1) = BINARY_CHECKSUM(b.col2) Girish Kumar Sharma

        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