Invalid row-count in subquery Error

Last post 05-13-2011 2:43 PM by Cholotron. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 05-13-2011 12:28 PM

    Invalid row-count in subquery Error

    What  I am doing wrong here?

    UPDATE INV_LASTUSED
    SET SKU_NAME = (SELECT BKIC_PROD_DESC
    FROM DBACOPY.BKICMSTR WHERE BKIC_PROD_CODE = SKU)

    UPDATE INV_LASTUSED
    SET INV_LASTUSED.SKU_NAME =
        ( SELECT BKICMSTR.BKIC_PROD_DESC
           FROM DBACOPY.BKICMSTR
           WHERE BKICMSTR.BKIC_PROD_CODE = INV_LASTUSED.SKU )

    both return the error

    What does it means?

    Tanks!!!

     

     I did a count(*) on both tables. They are not the same. is that the problem?

    Crying

    Cholotron
  • 05-13-2011 12:49 PM In reply to

    Re: Invalid row-count in subquery Error


  • 05-13-2011 2:00 PM In reply to

    Re: Invalid row-count in subquery Error

    How many records does the query below return:

    SELECT BKIC_PROD_DESC
    FROM DBACOPY.BKICMSTR WHERE BKIC_PROD_CODE = SKU

    How about:

    SELECT BKICMSTR.BKIC_PROD_DESC
           FROM DBACOPY.BKICMSTR
           WHERE BKICMSTR.BKIC_PROD_CODE = INV_LASTUSED.SKU

     

    Each query should return only one (1) record.  If they don't, you will get the error you are seeing.

     

  • 05-13-2011 2:43 PM In reply to

    Re: Invalid row-count in subquery Error

     Hi

    That was the problem. one of my tables had duplicate records. My update query if working fine now.

    select distinct BKIC_PROD_CODE  from BKICMSTR
    group by BKIC_PROD_CODE
    having count(BKIC_PROD_CODE ) > 1
    order by BKIC_PROD_CODE 

    Thank you very much

    Party!!!

     

     

Page 1 of 1 (4 items)