on 11-18-2011 7:50 PM
hola a todos!!
tengo el siguiente query
SELECT 'xxxxxx' AS 'NIT DE DISTRIBUIDOR',CONVERT(NVARCHAR,MONTH(T0.[DocDate]))+'/'+CONVERT(NVARCHAR,YEAR(T0.[DocDate])) AS 'MES', T3.[LicTradNum]'NIT FERRETERIA',T3.[AliasName]'RAZON SOCIAL FERRETERIA',T1.[ItemCode], T1.[Dscription], T1.[VendorNum]'CODIGO PRODUCTO', T1.[Quantity]'CANTIDAD VENDIDA UND', T1.[LineTotal]'VENTA EN $ SIN IVA' FROM OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OSLP T2 ON T0.SlpCode = T2.SlpCode INNER JOIN OCRD T3 ON T0.CardCode = T3.CardCode INNER JOIN OITM T4 ON T1.ItemCode = T4.ItemCode WHERE T0.[DocDate] =[%0] AND T4.[CardCode] ='PINxxxxx' AND T3.[AliasName] LIKE 'FERRETERIA%'
hasta ahi esta todo bien....pero necesito poder anexarle los datos del vendedor : cedula y nombre
en la tabla de oslp esta el nombre pero no la cedula y para obtenerla tengo q relacionarla con la ocrd porque aqui esta creado como tipo proveedor
en oslp esta creado el nombre por ejemplo: F- PEREZ PEPITO, donde F significa que pertenece a Ferreteria, esto se puso asi para sacar la cartera por dpto. quedando asi ...SUBSTRING(A.[SlpName],3,12) para poder relacionar con cardname de la tabla OCRD, pero me sale error....como puedo agregar estos datos de nombre y cedula del vendedor al query???
Que error te sale? ya probaste con un left join a la OCRD ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
decidí adicionarle a la tabla oslp la cedula
gracias
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
103 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.