2

SQL を初めて使用するので、助けが必要です。

確定(confirmed=1)の予約日を苗字で調べたいSteven

このSQLクエリを手伝ってくれる人がいますか

table_member

+-----------+-----------+
|Member_id  | last_name |
+-----------+-----------+
| 1         | David     |
| 2         | owen      |
| 3         | Tom       |
| 4         | Steven    |
| 5         | Steven    |
| 6         | Steven    |
| 7         | Steven    |
| 8         | Steven    |
| 9         | Steven    |
+-----------+-----------+

テーブル予約

+-----------+-----------+-----------+-----------+
|resvationID|Member_id  | day       |   month   |
+-----------+-----------+-----------+-----------+
| 1         | 1         |   1       |     6     |
| 2         | 1         |   2       |     6     |
| 3         | 2         |   1       |     6     |
| 4         | 4         |   1       |     6     |
| 5         | 4         |   2       |     6     |
| 6         | 5         |   1       |     6     |
| 7         | 5         |   2       |     6     |
| 8         | 7         |   3       |     6     |
+-----------+-----------+-----------+-----------+

確認

+-----------+-----------+-----------+
|confirmID  |resvationID| confirmed |
+-----------+-----------+-----------+
| 1         | 1         |   1       |
| 2         | 2         |   1       |
| 3         | 3         |   0       |
| 4         | 4         |   0       |
| 5         | 5         |   1       |
| 6         | 6         |   1       |
| 7         | 7         |   0       |
| 8         | 8         |   1       |
+-----------+-----------+-----------+
4

3 に答える 3

0

すべてのテーブルに内部結合を適用する

select day,month from table_reservation inner join table_member on table_member.member_id=table_reservation.member_id
inner join confirm on confirm.reservationid=table_reservation.reservationid where confirm.confirmid=1
and table_member.last_name like 'Steven'
于 2012-12-22T20:23:27.520 に答える