Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2010
    Posts
    49

    Unanswered: Joins - Can I add text to where clause

    I have data in two different tables, to join the common denominators require either the use of a substr command or I was think could I do the following.

    Wriiten using substr would look like this

    where a = substr(b,4,5)

    The first 3 charcters of b are always abc, therefore if I wondered if it was possible to do something like this

    where 'abc'||a = b
    or where concat('abc',a)


    Neither works, can this be done is it just a syntax error or should I always use substr?

    Thanks in advance

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >Neither works, can this be done is it just a syntax error or should I always use substr?
    use SUBSTR() function
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Mar 2007
    Posts
    623
    Quote Originally Posted by Ziggadebo View Post
    Neither works, can this be done is it just a syntax error or should I always use substr?
    If it was syntax error, the execution of the query would fail with exception.
    As you did not exactly describe how "Neither works" exactly behaves, it is only possible to guess the reasons.
    I would bet on the fact that B value is longer than 5 characters/bytes.
    In that case, using SUBSTR seems to be the most clever thing.

  4. #4
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    If you could provide a test case, it would be easier to assist.

Posting Permissions

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