SELECT test_Categorydevice.Cd_Name, test_Typedevice.Device_Name,
test_Maintanance.Ma_Expire, test_detail.div_name
FROM test_Categorydevice INNER JOIN
test_Typedevice INNER JOIN
test_Maintanance ON test_Typedevice.Device_ID = test_Maintanance.Device_ID AND
test_Typedevice.div_id = test_Maintanance.div_id INNER JOIN
test_detail ON test_Maintanance.div_id = test_detail.div_id ON
test_Categorydevice.div_id = test_Maintanance.div_id AND
test_Categorydevice.Cd_ID = test_Maintanance.Cd_ID
WHERE (test_Maintanance.Ma_Expire BETWEEN GETDATE() AND DATEADD(Week, - 2, test_Maintanance.Ma_Expire))