我有3张桌子,如下:
Patron
======
patron_num
Booking_For_Schedule
====================
tname
date
time
booking_num
Booking_By_Patron
=================
booking_num
patron_num
我想检索带有patron_num
、date
、time
和列的结果tname
,如下所示:
patron_num date time tname
1 2013-11-03 20:00 TestName
...ETC
这个作业问题的目的是教我们 INNER JOINS,但我遇到了一些困难。某种 SO 用户可以将我推向正确的方向吗?
这是我的 SQL:
SELECT `patron_num`,`date`,`time`,`tname`
FROM `booking_for_schedule` `F`
INNER JOIN `booking_by_patron` `B` on `F`.`booking_num` = `B`.`booking_num`
INNER JOIN `patron` `P` on `B`.`patron_num`=`P`.`patron_num`
返回错误:#1052 - Column 'patron_num' in field list is ambiguous