PL by Segment

4 weeks ago 13

Would immoderate 1 assistance maine to recognize what's the occupation with the beneath query are:

/* SELECT FROM [dbo].[JDT1] */
DECLARE FDT TimeStamp;
FDT := /* JDT1."DocDate" */'[%0]';

/* SELECT FROM [dbo].[JDT1] */
DECLARE TDT TimeStamp;
TDT := /* JDT1."DocDate" */'[%1]';

select OACT."AcctCode",OACT."AcctName", OACT."OverCode",OACT."ValidFor",OACT."ValidFrom", lawsuit erstwhile MC."Amt" is null past 0 other MC."Amt" extremity arsenic "Motorcycle", lawsuit erstwhile SP."Amt" is null past 0 other SP."Amt" extremity arsenic "Spareparts" from OACT
left outer articulation (select JDT1."Account" arsenic "GLCode", SUM(JDT1."Debit"-JDT1."Credit") arsenic "Amt" from JDT1 wherever JDT1."RefDate" betwixt :FDT and :TDT and jdt1."ProfitCode" = 'BSG0001' radical by JDT1."Account" bid by JDT1."Account") MC connected MC."GLCode"=OACT."AcctCode"
left outer articulation (select JDT1."Account" arsenic "GLCode", SUM(JDT1."Debit"-JDT1."Credit") arsenic "Amt" from JDT1 wherever JDT1."RefDate" betwixt :FDT and :TDT and jdt1."ProfitCode" = 'BSG0002' radical by JDT1."Account" bid by JDT1."Account") SP connected SP."GLCode"=OACT."AcctCode"
Where OACT."Levels" = '6' and OACT."AcctCode" Like '4%%'
union all
select OACT."AcctCode",OACT."AcctName", OACT."OverCode",OACT."ValidFor",OACT."ValidFrom", lawsuit erstwhile MC."Amt" is null past 0 other MC."Amt" extremity arsenic "Motorcycle", lawsuit erstwhile SP."Amt" is null past 0 other SP."Amt" extremity arsenic "Spareparts" from OACT
left outer articulation (select JDT1."Account" arsenic "GLCode", SUM(JDT1."Debit"-JDT1."Credit") arsenic "Amt" from JDT1 wherever JDT1."RefDate" betwixt :FDT and :TDT and jdt1."ProfitCode" = 'BSG0001' radical by JDT1."Account" bid by JDT1."Account") MC connected MC."GLCode"=OACT."AcctCode"
left outer articulation (select JDT1."Account" arsenic "GLCode", SUM(JDT1."Debit"-JDT1."Credit") arsenic "Amt" from JDT1 wherever JDT1."RefDate" betwixt :FDT and :TDT and jdt1."ProfitCode" = 'BSG0002' radical by JDT1."Account" bid by JDT1."Account") SP connected SP."GLCode"=OACT."AcctCode"
Where OACT."Levels" = '6' and OACT."AcctCode" Like '5%%'
union all
select OACT."AcctCode",OACT."AcctName", OACT."OverCode",OACT."ValidFor",OACT."ValidFrom", lawsuit erstwhile MC."Amt" is null past 0 other MC."Amt" extremity arsenic "Motorcycle", lawsuit erstwhile SP."Amt" is null past 0 other SP."Amt" extremity arsenic "Spareparts" from OACT
left outer articulation (select JDT1."Account" arsenic "GLCode", SUM(JDT1."Debit"-JDT1."Credit") arsenic "Amt" from JDT1 wherever JDT1."RefDate" betwixt :FDT and :TDT and jdt1."ProfitCode" = 'BSG0001' radical by JDT1."Account" bid by JDT1."Account") MC connected MC."GLCode"=OACT."AcctCode"
left outer articulation (select JDT1."Account" arsenic "GLCode", SUM(JDT1."Debit"-JDT1."Credit") arsenic "Amt" from JDT1 wherever JDT1."RefDate" betwixt :FDT and :TDT and jdt1."ProfitCode" = 'BSG0002' radical by JDT1."Account" bid by JDT1."Account") SP connected SP."GLCode"=OACT."AcctCode"
Where OACT."Levels" = '6' and OACT."AcctCode" Like '6%%'
union all
select OACT."AcctCode",OACT."AcctName", OACT."OverCode",OACT."ValidFor",OACT."ValidFrom", lawsuit erstwhile MC."Amt" is null past 0 other MC."Amt" extremity arsenic "Motorcycle", lawsuit erstwhile SP."Amt" is null past 0 other SP."Amt" extremity arsenic "Spareparts" from OACT
left outer articulation (select JDT1."Account" arsenic "GLCode", SUM(JDT1."Debit"-JDT1."Credit") arsenic "Amt" from JDT1 wherever JDT1."RefDate" betwixt :FDT and :TDT and jdt1."ProfitCode" = 'BSG0001' radical by JDT1."Account" bid by JDT1."Account") MC connected MC."GLCode"=OACT."AcctCode"
left outer articulation (select JDT1."Account" arsenic "GLCode", SUM(JDT1."Debit"-JDT1."Credit") arsenic "Amt" from JDT1 wherever JDT1."RefDate" betwixt :FDT and :TDT and jdt1."ProfitCode" = 'BSG0002' radical by JDT1."Account" bid by JDT1."Account") SP connected SP."GLCode"=OACT."AcctCode"
Where OACT."Levels" = '6' and OACT."AcctCode" Like '7%%'
union all
select OACT."AcctCode",OACT."AcctName", OACT."OverCode",OACT."ValidFor",OACT."ValidFrom", lawsuit erstwhile MC."Amt" is null past 0 other MC."Amt" extremity arsenic "Motorcycle", lawsuit erstwhile SP."Amt" is null past 0 other SP."Amt" extremity arsenic "Spareparts" from OACT
left outer articulation (select JDT1."Account" arsenic "GLCode", SUM(JDT1."Debit"-JDT1."Credit") arsenic "Amt" from JDT1 wherever JDT1."RefDate" betwixt :FDT and :TDT and jdt1."ProfitCode" = 'BSG0001' radical by JDT1."Account" bid by JDT1."Account") MC connected MC."GLCode"=OACT."AcctCode"
left outer articulation (select JDT1."Account" arsenic "GLCode", SUM(JDT1."Debit"-JDT1."Credit") arsenic "Amt" from JDT1 wherever JDT1."RefDate" betwixt :FDT and :TDT and jdt1."ProfitCode" = 'BSG0002' radical by JDT1."Account" bid by JDT1."Account") SP connected SP."GLCode"=OACT."AcctCode"
Where OACT."Levels" = '6' and OACT."AcctCode" Like '8%%'
union all
select OACT."AcctCode",OACT."AcctName", OACT."OverCode",OACT."ValidFor",OACT."ValidFrom", lawsuit erstwhile MC."Amt" is null past 0 other MC."Amt" extremity arsenic "Motorcycle", lawsuit erstwhile SP."Amt" is null past 0 other SP."Amt" extremity arsenic "Spareparts" from OACT
left outer articulation (select JDT1."Account" arsenic "GLCode", SUM(JDT1."Debit"-JDT1."Credit") arsenic "Amt" from JDT1 wherever JDT1."RefDate" betwixt :FDT and :TDT and jdt1."ProfitCode" = 'BSG0001' radical by JDT1."Account" bid by JDT1."Account") MC connected MC."GLCode"=OACT."AcctCode"
left outer articulation (select JDT1."Account" arsenic "GLCode", SUM(JDT1."Debit"-JDT1."Credit") arsenic "Amt" from JDT1 wherever JDT1."RefDate" betwixt :FDT and :TDT and jdt1."ProfitCode" = 'BSG0002' radical by JDT1."Account" bid by JDT1."Account") SP connected SP."GLCode"=OACT."AcctCode"
Where OACT."Levels" = '6' and OACT."AcctCode" Like '9%%'
order by OACT."AcctCode";

Whenever I tally this query, its shows antithetic errors like-

  • 'Document' (RDOC)
  • 'User-Defined Values' (CSHS)
  • 'Backend scheduling job' (OBSJ)

But aforesaid query moving good erstwhile I usage static dates similar -

/* SELECT FROM [dbo].[JDT1] */
DECLARE FDT TimeStamp;
FDT := /* JDT1."DocDate" */'2024.08.01';

/* SELECT FROM [dbo].[JDT1] */
DECLARE TDT TimeStamp;
TDT := /* JDT1."DocDate" */'2024.08.31';

Read Entire Article