私は、ビジネスニーズに合わせた簡単な生産性ダッシュボードレポートを作成し、これをどうやって解決するかについての問題に取り組んでいます。内部Select文ヘルプ - サブクエリ?
ユーザーが順番に完了する必要がある7つのタスクがあります。 1つの行を表示して、完了した各日付を表示したいが、それらは異なる行項目として表示されている。
1つの広告申込情報として表示するにはどうすればよいですか?ここで私が構築されたコードだ:
select
o.Number as 'OrderNo',
s.FullName as 'CPC Emp',
case when t.description='Loan Package to Lender' then t.CompletedDate else NULL end as 'Loan Pck To Lender',
case when t.description='Recording Audit' then t.CompletedDate else NULL end as 'Recording Audit',
case when t.description='Recorded Docs' then rt.RequestedDate else NULL end as 'Recorded Docs Requested',
case when t.description='Recorded Docs to Lender' then t.CompletedDate else NULL end as 'Recorded Docs to Lender',
case when t.description='Recorded Docs to Purchaser' then t.CompletedDate else null end as 'Recorded Docs to Purchaser',
case when t.description='Title Policy to Lender' then t.CompletedDate else NULL end as 'TP to Lender',
case when t.description='Title Policy to Purchaser' then t.CompletedDate else NULL end as 'TP Purchaser'
FROM pf.OrderInfo oi
INNER JOIN pfm.[Order] o
on (o.RootId# = oi.rootid)
INNER JOIN core.Profile op
ON (oi.OwningProfileID = op.ID)
INNER JOIN zref.OrderStatus os
ON (oi.OrderStatus = os.ID)
INNER JOIN zref.ProductType pt
on (o.ProductTypeID = pt.ID and pt.ID <>'15')
INNER JOIN pfm.Task t
ON (t.RootId# = oi.RootID
and (t.Description in ('Loan Package to Lender','Recording Audit','Recorded Docs to Lender',
'Recorded Docs to Purchaser', 'Title Policy to Lender','Title Policy to Purchaser','Recorded Docs')
))
left outer JOIN pfm.RequestedTask rt
ON (rt.RootId# = t.RootId# and rt.Id#=t.Id# and rt.LastId# = t.LastId#)
left outer JOIN core.SecurityIdentity s
ON (s.ID = t.CompletedByID)
WHERE
(op.Name like 'BH104%' -- Profiles Begin.
or op.name like 'WO115%' --Profiles End.
)
and t.CompletedDate between '2016-1-1' and '2016-4-30'
and s.fullname is not null
group by s.fullname, o.Number, t.Description, t.CompletedDate, rt.RequestedDate
order by 2 desc
どのように私はそれがそれらの赤いボックス結果に1行の項目を表示するのですか?どんな助けでも大いに感謝しています。私は内側のselect文とサブクエリを試しましたが、それを得ることができませんでした。
ありがとうございます!
ワウ、知っているのは素晴らしいです!これは私が必要なものでなければなりません..ありがとう! – user3571153