Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2015

    Question Unanswered: Informix SQL Join Question

    Good morning Forum users!

    First off I am no SQL expert and this may be a simple answer but is eluding me.
    I am looking to reference two tables and extract one field twice in table B based on two different criteria in Table A.

    There is a it_xref table A that contains the following fields:
    Column name Type

    sr_item_key integer
    sr_mcode char(5)
    sr_icode char(5)
    nb_item_key integer
    nb_mcode char(5)
    nb_icode char(5)

    In another table called items
    I need to select the description field for a value called item_key that matches the above two fields sr_item_key and nb_item_key
    so that my output would be
    sr_item_key description nb_item_key description
    (the item_key in items table will match sr_item_key and nb_item_key) so need to reference each different description and return it based on that.

    This will only return the description based on the first sr_item_key and not the second one (obviously) all my join efforts have failed with syntax errors

    select t.description,
    from it_xref i, items t
    where i.nb_item_key = t.item_key

    Any help would be GREATLY appreciated.

    Thanks and have a wonderful day

    PS this is informix


  2. #2
    Join Date
    May 2008

    you have an extra comma at the end of line 4 before the "from" clause, that's your syntax error.


Tags for this Thread

Posting Permissions

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