Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2009
    Posts
    2

    Unhappy Unanswered: mismatched fields in a view

    Can anyone help!! I have a report using a view looking at two SQL DB which is working to a point.
    The problem is on the linked field, the data in one contains numerics (6) charactors, however the other one contains upto (30) charactors, (see below)
    field1 712987
    field2 712987 / PLM12-WH

    This example will not be returned in the report because my join (eg) "field1 = field2" is not true.
    Is there a way around this. Thanks.....

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    join on Field1 = left(Field2, 6)
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Jul 2003
    Location
    The Dark Planet
    Posts
    1,401
    or maybe

    CHARINDEX ( field1, field2 ) != 0
    Get yourself a copy of the The Holy Book

    order has no physical Brett in The meaning of a Kaiser . -database data

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    'Fraid not Enigma... Imagine the following

    field1 712
    field2 712987 / PLM12-WH

    George
    Home | Blog

  5. #5
    Join Date
    Feb 2009
    Posts
    2

    Thumbs up

    Thanks for the help. I used Blindman's suggestion which worked for me.
    I since discovered a result by creating an alias col using select in my view, which does a similar thing to return the first 6 char of field2.
    Thanks again..... .

Posting Permissions

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