Need help with inner join

  • Hi,

    I have a dial table with one field Calldata. The value in this field is a delimited string like "name^address^city^state^Zipcode^^Phone". Now I want to join this table with another table CAZip to find out records that zip code in CAZip table. How can I do it.

    Really appreciate your help.

    Anthony

  • What you have is not relational database actually.

    This forum is not about working with "flat file" kind of data.

    Change your table to relational type - one entity=one table, one value type=one column, and then relational model will work for you.

     

    _____________
    Code for TallyGenerator

  • It's a relational database, I didn't make me clear. the calldata field is only one of the field in dial table. Actually our Dialer vender created that database for using dialer to automatically make phone call.

  • As Sergiy said create a table with all fields and for calldata make a query

    SELECT name + '^' + address + '^' + city + '^' + state + '^' + Zipcode + '^^' + Phone as calldata FROM tableName

    If the changing that is not in your hands then create a function to extract ZipCOde from the string and use it to join with other table.

    Regards,
    gova

  • No, it is NOT a relational database.

    Your calldata field contains at least 5 fields:

    name;address;city;state;Zipcode;Phone.

    So it must be separate table "CallData", one column for name, one for address, etc.

    And it must be CallDataId in your original table instead of Calldata field referenced by FK to ID in CallData table..

    Only then it will become relational database.

    _____________
    Code for TallyGenerator

  • >>It's a relational database

    That's even worse then. Care to tell us who your dialler vendor is so we can avoid them ?

    You need to read BOL on the PatIndex() function, used in conjunction with SubString(), to parse out the "fields".

     

     

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply