字段列表中的“ RentalDate”不明确
drop view if exists event;
create view event as
select concat(customer.firstname, " ", customer.surname) as title,
Concat(DATE_FORMAT(RentalDate,'%Y-%m-%d'), "T", StartTime) as start,
concat("Equipmentitem: " ,equipmentitem.id) as equipment,rental.id as id
from customer, equipmentitem, rental
where customer.ID = rental.CustomerID and equipmentitem.id=rental.EquipmentID;
这是数据库中的表
Create Table Rental
(
RentalID integer,
RentalDate Datetime,
ReturnDate Datetime,
RentalInvoice Integer,
Primary Key(RentalID),
Foreign Key(CustomerID) references Customer(CustomerID),
Foreign Key(DeliveryID) references Delivery(DeliveryID),
);
Insert into Rental(RentalID, RentalDate, ReturnDate, RentalInvoice,) values(1,'2018-3-8','2019-3-8','3');
Insert into Rental(RentalID, RentalDate, ReturnDate, RentalInvoice,) values(2,'2017-3-8','2018-3-8','4');
Insert into Rental(RentalID, RentalDate, ReturnDate, RentalInvoice,) values(3,'2018-1-6','2019-2-6','5');
Insert into Rental(RentalID, RentalDate, ReturnDate, RentalInvoice,) values(4,'2018-4-10','2018-3-12','6');
Insert into Rental(RentalID, RentalDate, ReturnDate, RentalInvoice,) values(5,'2018-2-7','2019-3-11','8');
Insert into Rental(RentalID, RentalDate, ReturnDate, RentalInvoice,) values(6,'2018-3-8','2019-3-9','7');
答案 0 :(得分:0)
这意味着'RentalDate'对于不同的表是通用的
尝试
Concat(DATE_FORMAT(<nameOfTable>.RentalDate,'%Y-%m-%d'), "T", <nameOfTable>.StartTime) as start