Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2003
    Posts
    7

    Unhappy Unanswered: interbase sql query

    Hi,

    I am trying to run the following query but it does not work.

    select sum(distinct i.quantity as VAL), i.oemnumber
    from issuedstock i, so_oem_lookup s
    where i.sonumber = 112
    and i.oemnumber = s.oemnumber
    and s.qtyneeded = VAL
    group by i.oemnumber

    I want to check the sum of a bunch of fields in one table against one field in another table, and if they match to display the results. This isn't working however.....

    The sum of all of the quantity fields in issuedstock should match with the qtyneeded in the so_oem_lookup table.

    ~Can anyone see a way to do this? I've tried to use AS but I am getting nowhere.

    Thanks in advance

    Chris Moore

    Error Message in IBConsole:

    Dynamic SQL Error
    SQL error code = -104
    Token unknown - line 1, char 31
    as
    Statement: select sum(distinct i.quantity as VAL), i.oemnumber
    from issuedstock i, so_oem_lookup s
    where i.sonumber = 112
    and i.oemnumber = s.oemnumber
    and s.qtyneeded = VAL
    group by i.oemnumber

  2. #2
    Join Date
    Nov 2002
    Location
    Romania
    Posts
    1

    Re: interbase sql query

    Originally posted by gameover
    Hi,

    I am trying to run the following query but it does not work.

    select sum(distinct i.quantity as VAL), i.oemnumber
    from issuedstock i, so_oem_lookup s
    where i.sonumber = 112
    and i.oemnumber = s.oemnumber
    and s.qtyneeded = VAL
    group by i.oemnumber

    Try: select sum(distinct i.quantity) as VAL ...

Posting Permissions

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