on 09-18-2013 7:57 AM
Hi every one,
I write query for finding serial no in delivery document,
select odln.DocNum,dln1.ItemCode,osrn.DistNumber from dln1
inner join Odln on dln1.DocEntry= odln.docentry
inner join OSRN on dln1.Itemcode=osrn.itemcode
But it returns all the serial of item.It is not not fetching deleverd serial no's.
Is there any changes to get the correct result.
Thanks and Regards
DEV
for better performance, please use below script
select odln.DocNum,dln1.ItemCode,osrn.DistNumber from dln1
inner join Odln on dln1.DocEntry= odln.docentry
inner join OITL on dln1.DocEntry = OITL.ApplyEntry and dln1.LineNum = OITL.ApplyLine and OITL.ApplyType = 15
inner join ITL1 on OITL.LogEntry = ITL1.LogEntry
inner join OSRN on ITL1.Itemcode=osrn.itemcode and ITL1.MdAbsEntry = OSRN.AbsEntry
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Boa tarde.
Eu consegui desta forma:
SELECT
T0."CardCode",
T0."CardName",
T1."ItemCode",
T1."CFOPCode",
T0."Serial" AS "N° Nota Fiscal",
T1."DocEntry",
T2."SysNumber",
T2."AbsEntry",
T2."UserSign",
T2."DistNumber"
FROM ODLN T0
INNER JOIN DLN1 T1 ON T0."DocEntry" = T1."DocEntry"
LEFT JOIN OSRN T2 ON T0."DocNum" = T2."SysNumber" AND T1."ItemCode" = T2."ItemCode"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi DEV RAJ,
try this,
/*SELECT FROM [dbo].[ODLN] T10*/
declare @fromdate as datetime
/* WHERE */
set @fromdate = /* T10.DocDate */ '[%0]'
/*SELECT FROM [dbo].[ODLN] T11*/
declare @ToDate as datetime
/* WHERE */
set @ToDate = /* T11.DocDate */ '[%1]'
SELECT T0.[DocNum], T0.[CardCode], T1.[ItemCode], T1.[Dscription], T1.[Quantity], T3.[IntrSerial]
FROM ODLN T0
INNER JOIN DLN1 T1 ON T0.DocEntry = T1.DocEntry
left join SRI1 T2 on T2.[BaseNum] = T0.[DocNum] and T2.[BaseLinNum] = T1.[LineNum]
left JOIN OSRI T3 ON T2.SysSerial = T3.SysSerial and T3.[ItemCode] = T2.[ItemCode]
WHERE T0.[DocDate] between @fromdate and @todate
GROUP BY T0.[DocNum], T0.[CardCode], T1.[ItemCode], T1.[Dscription], T1.[Quantity], T3.[IntrSerial]
regards,
Raviraj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi DR,
Try this:
SELECT T0.[DocNum], T0.[CardCode], T1.[ItemCode], T1.[Dscription], T1.[Quantity], T3.[IntrSerial] FROM ODLN T0 INNER JOIN DLN1 T1 ON T0.DocEntry = T1.DocEntry left join SRI1 T2 on T2.[BaseNum] = T0.[DocNum] and T2.[BaseLinNum] = T1.[LineNum] left JOIN OSRI T3 ON T2.SysSerial = T3.SysSerial and T3.[ItemCode] = T2.[ItemCode] WHERE T0.[DocDate] between [%0] and [%1] GROUP BY T0.[DocNum], T0.[CardCode], T1.[ItemCode], T1.[Dscription], T1.[Quantity], T3.[IntrSerial]
Thanks & Regards,
Nagarajan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nagarajan,
I add date parameters in sql
set @fromdate=convert(datetime,'20130401',112)
set @todate=convert(datetime,'20130917',112)
SELECT T0.[DocNum], T0.[CardCode], T1.[ItemCode], T1.[Dscription], T1.[Quantity], T3.[IntrSerial]
FROM ODLN T0
INNER JOIN DLN1 T1 ON T0.DocEntry = T1.DocEntry
left join SRI1 T2 on T2.[BaseNum] = T0.[DocNum] and T2.[BaseLinNum] = T1.[LineNum]
left JOIN OSRI T3 ON T2.SysSerial = T3.SysSerial and T3.[ItemCode] = T2.[ItemCode]
WHERE T0.[DocDate] between @fromdate and @todate GROUP BY T0.[DocNum], T0.[CardCode], T1.[ItemCode], T1.[Dscription], T1.[Quantity], T3.[IntrSerial]
but it returns nothing.Any changes required in this query.?
Thanks and Regards
DEV
Hi DR,
try this:
Declare @fromdate as nvarchar(20)
Declare @todate as nvarchar(20)
set @fromdate=convert(datetime,'20130401',112)
set @todate=convert(datetime,'20130917',112)
SELECT T0.[DocNum], T0.[CardCode], T1.[ItemCode], T1.[Dscription], T1.[Quantity], T3.[IntrSerial]
FROM ODLN T0
INNER JOIN DLN1 T1 ON T0.DocEntry = T1.DocEntry
left join SRI1 T2 on T2.[BaseNum] = T0.[DocNum] and T2.[BaseLinNum] = T1.[LineNum]
left JOIN OSRI T3 ON T2.SysSerial = T3.SysSerial and T3.[ItemCode] = T2.[ItemCode]
WHERE T0.[DocDate] between @fromdate and @todate GROUP BY T0.[DocNum], T0.[CardCode], T1.[ItemCode], T1.[Dscription], T1.[Quantity], T3.[IntrSerial]
Thanks & Regards,
Nagarajan
User | Count |
---|---|
107 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
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.