Notifications
Clear all

Câu truy vấn Service call với các tham số theo trạng thái và khoảng ngày

1 Posts
1 Users
0 Reactions
22 Views
admin
Posts: 496
Admin
Topic starter
(@admin)
Knight3
Joined: 3 years ago

Áp dụng câu truy vấn sau để thực hiện truy vấn bằng Query Generator trong SAP B1

Declare @FromDate Date
Declare @ToDate Date

select top 1 @FromDate=updateDate  from [OSCL] T0 where T0.updateDate =[%0]
set @FromDate=[%0]

select top 1 @ToDate=updateDate  from [OSCL] T0 where T0.updateDate =[%1]
set @ToDate=[%1]

select S0.callID, min(S0.updateDate)
from 
(
select callID, status, updateDate from OSCL  
union 
select callID, status, updateDate from ASCL
) S0
left join OSCS S1 on S0.status = S1.statusID
where S0.updateDate between @FromDate and @ToDate and S1.Name ='[%2]'
group by S0.callID

Reply
Share:
x  Powerful Protection for WordPress, from Shield Security
This Site Is Protected By
Shield Security