Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3280

query with WHILE

$
0
0

good afternoon all

 

 

I'm doing the following query where, I am taking a WHILE returning me the lines of quantity

 

buenas tardes foro estoy realizando la siguiente consulta donde esto ocupando un WHILE que me regresa los renglones según las cantidades

 

WHILE @i <= (select B.Quantity/B.PackQty from ORDR A INNER JOIN RDR1 B on A.DocEntry = B.DocEntry where A.DocNum = 3828)

      BEGIN;

            IF (@i%1000!=0)

                  PRINT @i

            SET @i=@i+1;

      END;

 

 

all goes well only when my order is the one line, if is two line mark  error. can I  solve this situation?

 

 

 

 

 

ERROR

 

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


Viewing all articles
Browse latest Browse all 3280

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>