 |
สอบถามปัญหาคำสั่ง SQL เกี่ยวกับการใช้ WHERE ใน Column ที่เก็บข้อมูลปี |
|
 |
|
|
 |
 |
|
ลองแบบนี้
Code (SQL)
Select DISTINCT a.Employee_ID,b.GradeSalary,b.Year
From (SELECT * FROM Profile ) a
INNER JOIN (SELECT Employee_ID, Year,GradeSalary from evaluation) b On a.Employee_ID=b.Employee_ID
WHERE b.GradeSalary = 'A' AND Year >= '2012' AND Year <= '2015'
having count(a.Employee_ID)>3
หรือ
Code (SQL)
Select DISTINCT a.Employee_ID,b.GradeSalary,b.Year
From (SELECT * FROM Profile ) a
INNER JOIN (SELECT Employee_ID, Year,GradeSalary from evaluation) b On a.Employee_ID=b.Employee_ID
inner join (select Employee_ID,count(Employee_ID) as cg from evaluation where GradeSalary = 'A' and Year >= '2012' AND Year <= '2015' group by Employee_ID) as c on a.Employee_ID=c.Employee_ID and c.cg>3
WHERE b.GradeSalary = 'A' AND Year >= '2012' AND Year <= '2015'
ปล. 2012-2015 มัน 4 ปีป่าวครับ
|
 |
 |
 |
 |
Date :
2015-03-30 14:47:04 |
By :
ผ่านมา |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|