Results 1 to 3 of 3

Thread: Operator LIKE

  1. #1
    Join Date
    Feb 2005
    Location
    Barcelona
    Posts
    42

    Angry Unanswered: Operator LIKE



    SELECT csaldos.empcode, cmaprpro.caupro
    FROM csaldos
    INNER JOIN cmaprpro ON csaldos.proyec LIKE cmaprpro.proyec

    132 DB2 SQL error: SQLCODE: -132, SQLSTATE: 42824, SQLERRMC:
    727 DB2 SQL error: SQLCODE: -727, SQLSTATE: 56098, SQLERRMC: 2;-132;42824;

    Obiously, this is an illegal use of operator LIKE but, anyone could write to me an alternative way of get the same?


  2. #2
    Join Date
    Jan 2003
    Posts
    1,605
    Hi,

    LIKE can only be used in where cause.
    Write something like:

    SELECT csaldos.empcode, cmaprpro.caupro
    FROM csaldos
    INNER JOIN cmaprpro ON (csaldos.proyec = condition) WHERE cmaprpro.proyec LIKE condition.

    Hope this helps,
    Grofaty
    Last edited by grofaty; 02-22-05 at 07:17.

  3. #3
    Join Date
    Jan 2003
    Posts
    1,605
    What would you like to do? LIKE or JOin?

    If join:
    SELECT csaldos.empcode, cmaprpro.caupro
    FROM csaldos
    INNER JOIN cmaprpro ON (csaldos.proyec = cmaprpro.proyec)

    or

    SELECT csaldos.empcode, cmaprpro.caupro
    FROM csaldos, cmaprpro
    WHERE csaldos.proyec = cmaprpro.proyec

Posting Permissions

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