我的表如下所示
Regno Date Year Batch h1 h2 h3 h4 h5 Att
1138M0345 25-07-2013 3 1 P P P NULL NULL NULL
1138M0346 25-07-2013 3 1 P P P NULL NULL NULL
1138M0347 25-07-2013 3 1 P P P NULL NULL NULL
1138M0348 25-07-2013 3 1 P P P NULL NULL NULL
1138M0349 25-07-2013 3 1 P P P NULL NULL NULL
1138M0350 25-07-2013 3 1 P P P NULL NULL NULL
1138M0351 25-07-2013 3 1 P P P NULL NULL NULL
1138M0352 25-07-2013 3 1 P P P NULL NULL NULL
1138M0353 25-07-2013 3 1 P P P NULL NULL NULL
1138M0343 25-07-2013 3 1 A A A NULL NULL NULL
1138M0344 25-07-2013 3 1 A A A NULL NULL NULL
h1、h2、h3、h4、h5、att 字段可以存储空值att 字段是存储学生当天的出勤情况。在以下情况下,我需要使用P/A/1/2更新字段att
1. 'P' if H1 through H5 contains 'P' (Meaning present for the whole day)
2. '1' if H1 through H3 contains 'P' (Meaning present for the first session)
3. '2' if H4 and H5 contains 'P' (Meaning present for the second session)
4. NULL if any of H1 through H5 contains NULL (Meaning table needs to be updated completely)
5. Else 'A' (Meaning absent for the whole day)
谁能帮我解释一下逻辑