XML PATH がどのように機能するかを理解することは言うまでもなく、XML PATH をコードに追加していくつかの情報を連結する方法を見つけようとして、ひどい時間を過ごしています。過去 2 日間の大部分をこの作業に費やしてきました。助けていただければ幸いです!!
ここに私が取り組んでいるコードがあります:
Select Top 100 Percent Agreements.AgrmntID, Agreements.Description As
AgrmntDesc, Agreements.Status, AgreementSchedules.SchedDate, DateName(dw,
AgreementSchedules.SchedDate), LaborCodeTypes.Description As LaborCode,
Customers.CustName, Customers.CompanyName, JobSites.SiteName,
AgreementSchedules.AgrmntSchedID
From Agreements Inner Join
AgreementTypes On Agreements.AgrmntTypeID = AgreementTypes.AgrmntTypeID
Inner Join
AgreementSchedules On Agreements.AgrmntID = AgreementSchedules.AgrmntID
Inner Join
Customers On Agreements.CustID = Customers.CustID Inner Join
JobSites On Agreements.CustSiteID = JobSites.CustSiteID Left Outer Join
LaborCodeTypes On AgreementSchedules.RepairID = LaborCodeTypes.RepairID
Where Agreements.Status = 2 And Month(AgreementSchedules.SchedDate) =
Month(GetDate())
サンプルデータ:
| AgreementID | LaborCodeTypes.Description | DateName(dw, AgreementSchedules.SchedDate)|
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -|
| 1 | Landscaping | Tuesday |
| 1 | Landscaping | Friday |
| 1 | Sweeping | Monday |
| 1 | Sweeping | Wednesday |
| 1 | Sweeping | Friday |
| 2 | Landscaping | Monday |
期待される出力:
| AgreementID | LaborCode | Days Of Week |
| - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 1 | Landscaping | Tuesday, Friday |
| 1 | Sweeping | Monday, Wednesday, Friday |
| 2 | Landscaping | Monday |
誰かが私を助けてくれれば、とても感謝しています。
前もって感謝します!!
ジェイミー S