私はこれらのテーブルを持っています:
Student_records
------------------------------
| ID | 生徒の名前 |
| | 1 | チェスコ |
| | 2 | ローレンツ |
| | 3 | バート |
| | 4 | ジュリアス |
| | 5 | ドム | ドム |
------------------------------
学生_出席
-------------------------------------------------- ---
| ID | 学生_日付 | time_in | タイムアウト
| 1 | 2013 年 1 月 1 日 | 午前 7:00 | 午後12時
| 1 | 2013 年 1 月 2 日 | 午前 8:00 | 午後12時
| 3 | 2013 年 2 月 14 日 | 午前 9:00 | 12:00
---------------------------------------------------- -------
このクエリを実行すると
select * from student_attendance
where id in('4','5')
and date in ('01-01-2013','01-02-2013')
レコードが存在しない場合に、time_in と time_out を null にするにはどうすればよいですか?ID と日付はクエリと同じままにしておきますか?
または私のクエリが間違っていますか?
私はすでに3日間これで立ち往生しています
どんな助けでも大歓迎です。ありがとう
アップデート
私はこれにたどり着きました
SELECT * FROM (select student_name、sa.time_in が null の場合、'' else sa.time_in END が time_in の場合、'' else sa.time_out END が time_out の場合、sa.student_date が null の場合) then '01-01-2013' else sa.student_date END は、student_records sr からの日付として終了します。
しかし今では、student_records に記録を持つデータは表示されません