Results 1 to 3 of 3

Thread: query to match

  1. #1
    Join Date
    Jul 2004
    Posts
    214

    Unanswered: query to match

    I have a table with two fields:
    Code:
    Field1 Field2
            S11.1  111001 
            S13     130001 
            S11     110001
            S13.1   120001
    I need to query to find where Field2's first three digits does not match the numbers in field1. Giving the sample: 120001 would be listed in the results because it does not match the numbers in S13.1 130001(2nd record) does because if there is no "."; it defaults to zero.
    I don't know to set up the criteria or what to ask so it would give me the results needed.
    Can anyone help please.
    Thanks

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    if all you want to do is to make sure the firsts two digits of column 2 match the 2& 3 digits of column1 then


    select <mycolumnlist> from <mytable>
    where mid$(<mycolumn1>,2,2) <> left$(<mycolumn2>,2)


    HTH

  3. #3
    Join Date
    Jul 2004
    Posts
    214
    Yes that's essential correct. I want the query to return where they Do Not match the 3 digits after the "S". If there's no ".", this defaults to 0. Sorry for the confusion. Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •