Hola tengo la siguiente consulta ES Bastante extensa pero es mas o menos así
Select
CantidadEmpacada,
CantidadFacturada
FROM PedidoEmpaque
WHERE (CantidadEmpacada - CantidadFacturada) > 0
me arroja 2 filas pero cuando se cumple la resta es igual a cero siguen saliendo las misma 2 filas He probado usando también <> 0 y != 0 pero los resultados son los mismos.
EDICION Coloco los datos para ejemplo @Lamak y @mauricioalvarez la cuestion es que en sql me esta mostrando todos los datos!!
CREATE TABLE [dbo].[PedidoEmpaque](
[NroPedido] [varchar](7) NOT NULL,
[IdReferenciaTamano] [int] NULL,
[CodigoTercero] [varchar](6) NOT NULL,
[RazonSocial] [varchar](100) NULL,
[NombreSucursal] [varchar](50) NULL,
[CantidadCancelada] [decimal](18, 2) NULL,
[DescuentoAdicionales] [decimal](6, 3) NULL,
[CantidadEmpacada] [decimal](18, 2) NULL,
[CantidadFacturada] [decimal](18, 2) NULL,
[PrecioUsuario] [decimal](9, 2) NOT NULL,
[Descuento] [decimal](6, 3) NULL,
[PrecioLista] [decimal](9, 2) NOT NULL
) ON [PRIMARY];
INSERT [dbo].[PedidoEmpaque] ([NroPedido], [IdReferenciaTamano],
[CodigoTercero], [RazonSocial], [NombreSucursal], [CantidadCancelada],
[DescuentoAdicionales], [CantidadEmpacada],[CantidadFacturada],
[PrecioUsuario], [Descuento], [PrecioLista]) VALUES (N'46', 47734,
N'000019',
N'GAMMA COLORS', N'SUCURSAL PRINCIPAL', CAST(0.00 AS Decimal(18, 2)),
CAST(0.000 AS Decimal(6, 3)), CAST(0.00 AS Decimal(18, 2)), CAST(0.00 AS
Decimal(18, 2)),CAST(0.00 AS Decimal(9, 2)), CAST(0.000 AS Decimal(6, 3)),
CAST(43920.00 AS Decimal(9, 2)));
INSERT [dbo].[PedidoEmpaque] ([NroPedido], [IdReferenciaTamano],
[CodigoTercero], [RazonSocial], [NombreSucursal], [CantidadCancelada],
[DescuentoAdicionales], [CantidadEmpacada],[CantidadFacturada],
[PrecioUsuario], [Descuento], [PrecioLista]) VALUES (N'49', 51964,
N'000019', N'GAMMA COLORS', N'SUCURSAL PRINCIPAL', CAST(0.00 AS Decimal(18,
2)), CAST(0.000 AS Decimal(6, 3)), CAST(500.00 AS Decimal(18,
2)),CAST(500.00 AS Decimal(18, 2)), CAST(0.00 AS Decimal(9, 2)), CAST(0.000
AS Decimal(6, 3)), CAST(2479.00 AS Decimal(9, 2)));
INSERT [dbo].[PedidoEmpaque] ([NroPedido], [IdReferenciaTamano],
[CodigoTercero], [RazonSocial], [NombreSucursal], [CantidadCancelada],
[DescuentoAdicionales], [CantidadEmpacada],[CantidadFacturada],
[PrecioUsuario], [Descuento], [PrecioLista]) VALUES (N'48', 52801,
N'005090', N'ALMACE BON AIR', N'SUCURSAL 01', CAST(0.00 AS Decimal(18, 2)),
CAST(0.000 AS Decimal(6, 3)), CAST(0.00 AS Decimal(18, 2)), CAST(0.00 AS
Decimal(18, 2)),CAST(0.00 AS Decimal(9, 2)), CAST(0.000 AS Decimal(6, 3)),
CAST(0.00 AS Decimal(9, 2)));
INSERT [dbo].[PedidoEmpaque] ([NroPedido], [IdReferenciaTamano],
[CodigoTercero], [RazonSocial], [NombreSucursal], [CantidadCancelada],
[DescuentoAdicionales], [CantidadEmpacada],[CantidadFacturada],
[PrecioUsuario], [Descuento], [PrecioLista]) VALUES (N'49', 34660,
N'000019', N'GAMMA COLORS', N'SUCURSAL PRINCIPAL', CAST(0.00 AS Decimal(18,
2)), CAST(0.000 AS Decimal(6, 3)), CAST(300.00 AS Decimal(18, 2)),
CAST(250.00 AS Decimal(18, 2)),CAST(0.00 AS Decimal(9, 2)), CAST(0.000 AS
Decimal(6, 3)), CAST(4032.00 AS Decimal(9, 2)));
INSERT [dbo].[PedidoEmpaque] ([NroPedido], [IdReferenciaTamano],
[CodigoTercero], [RazonSocial], [NombreSucursal], [CantidadCancelada],
[DescuentoAdicionales], [CantidadEmpacada],[CantidadFacturada],
[PrecioUsuario], [Descuento], [PrecioLista]) VALUES (N'46', 47734,
N'000019', N'GAMMA COLORS', N'SUCURSAL PRINCIPAL', CAST(0.00 AS Decimal(18,
2)), CAST(0.000 AS Decimal(6, 3)), CAST(458.00 AS Decimal(18, 2)),
CAST(458.00 AS Decimal(18, 2)),CAST(0.00 AS Decimal(9, 2)), CAST(0.000 AS
Decimal(6, 3)), CAST(43920.00 AS Decimal(9, 2)));
INSERT [dbo].[PedidoEmpaque] ([NroPedido], [IdReferenciaTamano],
[CodigoTercero], [RazonSocial], [NombreSucursal], [CantidadCancelada],
[DescuentoAdicionales], [CantidadEmpacada],[CantidadFacturada],
[PrecioUsuario], [Descuento], [PrecioLista]) VALUES (N'51', -1, N'000033',
N'CONFECCIONES D.LOLITA', N'SUCURSAL PRINCIPAL', CAST(0.00 AS Decimal(18,
2)), CAST(0.000 AS Decimal(6, 3)), CAST(0.00 AS Decimal(18, 2)),CAST(0.00 AS
Decimal(18, 2)), CAST(1000.00 AS Decimal(9, 2)), CAST(0.000 AS Decimal(6,
3)), CAST(0.00 AS Decimal(9, 2)));
lo ideal es que me muestre el resultado así como me sale en sql fiddle