¡Caminando hacia el éxito!

Aprende en Comunidad

Avalados por :

Optimización de Consulta SQL para Mostrar la Columna INV1.Text - Guía Paso a Paso

  • Creado 01/03/2024
  • Modificado 01/03/2024
  • 2 Vistas
0
Cargando...

Hola a todos

Por favor, ayúdenme si esta consulta es sencilla para ustedes. Intenté agregar la columna INV1.Text pero aún no se muestra en mi resultado.

SELECT T0.[DocDate], T0.[DocNum], t0.NUMATCARD, T0.[CardCode], T0.[CardName], T1.[ItemCode], T1.[Dscription], T1.[Quantity], T1.UnitMsr,T1.[PriceBefDi], T1.[Price], T1.[LineTotal], T0.[DiscPrcnt],T0.[DocTotal], T2.[SlpName]

INTO #INV

FROM OINV T0 INNER JOIN INV1 T1 ON T0.[DocEntry] = T1.[DocEntry] INNER JOIN OSLP T2 ON T0.[SlpCode] = T2.[SlpCode]

WHERE T0.[CardCode] >='[%0]' AND T0.[CardCode] <= '[%1]'

AND T0.[DocDate] >=[%2] AND T0.[DocDate] <= [%3]

AND T2.[SlpName] >='[%4]' AND T2.[SlpName] <= '[%5]'

INSERT INTO #INV

SELECT T0.[DocDate], T0.[DocNum], T0.NUMATCARD, T0.[CardCode], T0.[CardName], T1.[ItemCode], T1.[Dscription], T1.[Quantity]*-1, T1.UnitMsr,T1.[PriceBefDi]*-1, T1.[Price]*-1, T1.[LineTotal]*-1, T0.[DiscPrcnt],T0.[DocTotal]*-1,T2.[SlpName] FROM ORIN T0 INNER JOIN RIN1 T1 ON T0.[DocEntry] = T1.[DocEntry] INNER JOIN OSLP T2 ON T0.[SlpCode] = T2.[SlpCode] WHERE T0.[CardCode] >='[%0]' AND T0.[CardCode] <= '[%1]'

AND T0.[DocDate] >=[%2] AND T0.[DocDate] <= [%3]

AND T2.[SlpName] >='[%4]' AND T2.[SlpName] <= '[%5]'

SELECT T10.[DocDate], T10.[ItemCode], T10.[Dscription], SUM(T10.[Quantity]) as 'Cantidad', T10.UnitMsr, T10.[SlpName] FROM

#INV T10

group by T10.[DocDate], T10.[ItemCode], T10.[Dscription], T10.UnitMsr, T10.[SlpName]

Pedro Pascal
Se unió el 07/03/2018
Pinterest
Telegram
Linkedin
Whatsapp

4 Respuestas

0
Cargando...

Hola Johan

Intenté la Opción 1, hay datos pero no se agregó la columna para INV1.Text

La Opción 2 da error.

Opción 1

SELECT T0.[DocDate], T0.[DocNum], t0.NUMATCARD, T0.[CardCode], T0.[CardName], T1.[ItemCode], T1.[Dscription], T1.[Quantity], T1.UnitMsr,T1.[PriceBefDi], T1.[Price], T1.[LineTotal], T0.[DiscPrcnt],T0.[DocTotal], T2.[SlpName], T1.Text

INTO #INV

FROM OINV T0 INNER JOIN INV1 T1 ON T0.[DocEntry] = T1.[DocEntry] INNER JOIN OSLP T2 ON T0.[SlpCode] = T2.[SlpCode]

WHERE T0.[CardCode] >='[%0]' AND T0.[CardCode] <= '[%1]'

AND T0.[DocDate] >=[%2] AND T0.[DocDate] <= [%3]

AND T2.[SlpName] >='[%4]' AND T2.[SlpName] <= '[%5]'

INSERT INTO #INV

SELECT T0.[DocDate], T0.[DocNum], T0.NUMATCARD, T0.[CardCode], T0.[CardName], T1.[ItemCode], T1.[Dscription], T1.[Quantity]*-1, T1.UnitMsr,T1.[PriceBefDi]*-1, T1.[Price]*-1, T1.[LineTotal]*-1, T0.[DiscPrcnt],T0.[DocTotal]*-1,T2.[SlpName], T1.Text FROM ORIN T0 INNER JOIN RIN1 T1 ON T0.[DocEntry] = T1.[DocEntry] INNER JOIN OSLP T2 ON T0.[SlpCode] = T2.[SlpCode] WHERE T0.[CardCode] >='[%0]' AND T0.[CardCode] <= '[%1]'

AND T0.[DocDate] >=[%2] AND T0.[DocDate] <= [%3]

AND T2.[SlpName] >='[%4]' AND T2.[SlpName] <= '[%5]'

SELECT T10.[DocDate], T10.[ItemCode], T10.[Dscription], SUM(T10.[Quantity]) as 'Quantity', T10.UnitMsr, T10.[SlpName] FROM

#INV T10

group by T10.[DocDate], T10.[ItemCode], T10.[Dscription], T10.UnitMsr, T10.[SlpName]

Opción 2

SELECT T0.[DocDate], T0.[DocNum], t0.NUMATCARD, T0.[CardCode], T0.[CardName], T1.[ItemCode], T1.[Dscription], T1.[Quantity], T1.UnitMsr,T1.[PriceBefDi], T1.[Price], T1.[LineTotal], T0.[DiscPrcnt],T0.[DocTotal], T2.[SlpName], T1.Text

INTO #INV

FROM OINV T0 INNER JOIN INV1 T1 ON T0.[DocEntry] = T1.[DocEntry] INNER JOIN OSLP T2 ON T0.[SlpCode] = T2.[SlpCode]

WHERE T0.[CardCode] >='[%0]' AND T0.[CardCode] <= '[%1]'

AND T0.[DocDate] >=[%2] AND T0.[DocDate] <= [%3]

AND T2.[SlpName] >='[%4]' AND T2.[SlpName] <= '[%5]'

INSERT INTO #INV

SELECT T0.[DocDate], T0.[DocNum], T0.NUMATCARD, T0.[CardCode], T0.[CardName], T1.[ItemCode], T1.[Dscription], T1.[Quantity]*-1, T1.UnitMsr,T1.[PriceBefDi]*-1, T1.[Price]*-1, T1.[LineTotal]*-1, T0.[DiscPrcnt],T0.[DocTotal]*-1,T2.[SlpName], T1.Text FROM ORIN T0 INNER JOIN RIN1 T1 ON T0.[DocEntry] = T1.[DocEntry] INNER JOIN OSLP T2 ON T0.[SlpCode] = T2.[SlpCode] WHERE T0.[CardCode] >='[%0]' AND T0.[CardCode] <= '[%1]'

AND T0.[DocDate] >=[%2] AND T0.[DocDate] <= [%3]

AND T2.[SlpName] >='[%4]' AND T2.[SlpName] <= '[%5]'

SELECT T10.[DocDate], T10.[ItemCode], T10.[Dscription], SUM(T10.[Quantity]) as 'Quantity', T10.UnitMsr, T10.[SlpName], T10.Text FROM

#INV T10

group by T10.[DocDate], T10.[ItemCode], T10.[Dscription], T10.UnitMsr, T10.[SlpName], T10.Text

Respondido el 15/04/2024
LUCIANO RIOJA GHIOTTO
Se unió el 13/07/2019
0
Cargando...

Hola Kadlene,

¿Es posible que te refieras a [INV1.FreeTxt] en lugar de texto?

Saludos, Lothar

Respondido el 15/04/2024
LUCIANO RIOJA GHIOTTO
Se unió el 13/07/2019
0
Cargando...

Hola a todos

INV1.Text es la columna de detalles del artículo.

Respondido el 15/04/2024
LUCIANO RIOJA GHIOTTO
Se unió el 13/07/2019
0
Cargando...

Hola Kedalene,

Esta consulta no contiene INV1.Text. ¿Puedes mostrarme la consulta que intentaste?

Saludos,

Johan

Respondido el 15/04/2024
LUCIANO RIOJA GHIOTTO
Se unió el 13/07/2019

contacto@primeinstitute.com

(+51) 1641 9379
(+57) 1489 6964

© 2024 Copyright. Todos los derechos reservados.

Desarrollado por Prime Institute

¡Hola! Soy Diana, asesora académica de Prime Institute, indícame en que curso estas interesado, saludos!
Hola ¿Puedo ayudarte?