Ver Mensaje Individual
  #1  
Antiguo 14-08-2006
lynu lynu is offline
Registrado
 
Registrado: ago 2006
Posts: 8
Reputación: 0
lynu Va por buen camino
error "Subquery returned more than 1 value"

Código SQL [-]
update tbl_articulo 

set
    costo = (select tbl_detalle_nota_entrada.costo from tbl_detalle_nota_entrada
         where tbl_articulo.id_articulo = (select tbl_detalle_nota_entrada.id_producto from tbl_detalle_nota_entrada 
                                       where tbl_detalle_nota_entrada.id_nota_entrada = @id_nota_entrada )
         and tbl_detalle_nota_entrada.id_nota_entrada = @id_nota_entrada),

    almacen_1 = almacen_1 + (select tbl_detalle_nota_entrada.cantidad from tbl_detalle_nota_entrada  
                 where tbl_articulo.id_articulo = (select tbl_detalle_nota_entrada.id_producto from tbl_detalle_nota_entrada 
                                       where tbl_detalle_nota_entrada.id_nota_entrada = @id_nota_entrada )
                 and tbl_detalle_nota_entrada.id_nota_entrada = @id_nota_entrada),

    almacen_1_fecha = (select tbl_nota_entrada.fecha from tbl_nota_entrada
               where tbl_nota_entrada.id_nota_entrada = @id_nota_entrada)
    

where    tbl_articulo.id_articulo = (select tbl_detalle_nota_entrada.id_producto from tbl_detalle_nota_entrada 
                                       where tbl_detalle_nota_entrada.id_nota_entrada = @id_nota_entrada)


bueno este largo Stored Preocedure :d resulta si solo le envio 1 elemento, pero si existe mas de 1 me da un error tal como "Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression." me gustaria saber si alguien sabe como resolver este problema. cualquier duda del codigo pregunten


Última edición por lynu fecha: 14-08-2006 a las 14:14:54. Razón: el codigo estaba incompleto
Responder Con Cita