problem with Server: Msg 512, Level 16, State 1,

  • Hello masters , I have a problem with the next query

    Update CT_ProcesaArchivoCTC  set  iOwnerId=( select iOwnerid

           from CustomerProduct (nolock)

           where vchSerialNumber = CT_ProcesaArchivoCTC.username

               and     tiRecordStatus  = 1

               and     iSiteId         = 1

               and     iStatusid       = 10100      --cuenta activa

               and chProductNumber = '801'

               group by iOwnerid

           having count(*) = 1)

     

    Server: Msg 512, Level 16, State 1, Line 1

    Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

    The statement has been terminated.

    well i know because the query returns more one registers, but i need to exclude the cases when the query returns more one registers, i dont want to use a cursor and i want to do it using only a query.

    Thanks................sorry my english....

     

     

     

    is possible? thanks

  • I don't know exactly what criteria you are looking for, but you could try using select DISTINCT iOwnerid, if you are just making sure that there is at least one iOwnerid that meets your criteria. Excuse me if i am missing something.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply