snasui.com ยินดีต้อนรับ ยินดีต้อนรับสู่กระดานถามตอบ Excel and VBA และอื่น ๆ ที่เป็นมิตรกับทุกท่าน มีไฟล์แนบมหาศาล ช่วยให้ท่านค้นหาและติดตามศึกษาได้โดยง่าย สมาชิกท่านใดที่ยังไม่ได้ระบุ Version ของ Excel ที่ใช้งานจริง สามารถทำตาม Link นี้เพื่อจะได้รับคำตอบที่ตรงกับ Version ของท่านครับ ระบุ Version ของ Excel
เรียนอาจารย์ คิวรี่แสดงผลออกมาเกินกว่าจำนวนข้อมูลค่ะ ที่ถูกต้องคือต้องออกมาแค่ 25 record เท่ากับจำนวนในไฟล์ ztm_022
แต่มันแสดงออกมา 675 record
SELECT Pt_bal00.[Wage Type Long Text], Pt_bal00.[Number of hours], IIf(ztm.[Start Date] Not In (SELECT Pt_bal00.[Current Date] from Pt_bal00),'N','Y') AS STATUS, ztm.[Pers#No#] AS PersonnelNumber, ztm.[Personnel Number] AS NAME, ztm.[Personnel Area], ztm.[Personnel Subarea], ztm.[Employee Group], ztm.[Employee Subgroup], ztm.[Organizational Unit], ztm.[Position], ztm.[Start Date], ztm.[End Date], ztm.[Start], ztm.[End time], ztm.[A/AType], ztm.[Attendance or Absence Type], ztm.[Previous Day Indicator], ztm.[Days], ztm.[Payroll hrs], ztm.[Record is for Full Day], ztm.[Deb# order], ztm.[Debited Order], ztm.[Debited cost center], ztm.[Debited Cost Center1], ztm.[LI]
FROM ztm, Pt_bal00
WHERE ztm.[Previous Day Indicator]="No";
ขอบคุณค่ะ
You do not have the required permissions to view the files attached to this post.
ผลลัพธ์ที่ต้องแสดงคือ
- ดึงข้อมูลทั้งหมดของไฟล์ ztm022 และฟิลด์ 2 ฟิลด์ที่่ชื่อ Wage Type Long Text,Number of hours จากไฟล์ Pt_bal00
- เพิ่ม Field Status เพื่อบอกว่า Record ใดใน ztm022 ไม่มีในไฟล์ Ptbal00 ถ้ามีค่าในฟิลด์ Status จะแสดง Y ถ้าไม่มี N
SELECT Pt_bal00.[Wage Type Long Text], Pt_bal00.[Number of hours], IIf(ztm.[Start Date] Not In (SELECT Pt_bal00.[Current Date] from Pt_bal00),'N','Y') AS STATUS, ztm.[Pers#No#] AS PersonnelNumber, ztm.[Personnel Number] AS NAME, ztm.[Personnel Area], ztm.[Personnel Subarea], ztm.[Employee Group], ztm.[Employee Subgroup], ztm.[Organizational Unit], ztm.[Position], ztm.[Start Date], ztm.[End Date], ztm.[Start], ztm.[End time], ztm.[A/AType], ztm.[Attendance or Absence Type], ztm.[Previous Day Indicator], ztm.[Days], ztm.[Payroll hrs], ztm.[Record is for Full Day], ztm.[Deb# order], ztm.[Debited Order], ztm.[Debited cost center], ztm.[Debited Cost Center1], ztm.[LI]
FROM ztm, Pt_bal00
WHERE ztm.[Previous Day Indicator]="No";