試圖寫入MySQL將顯示Appointment_duration,mechanic_Firstname,mechanic_lastname,customer_firstname和customer_lastname約會的最大時間爲&,但我的代碼給我錯誤的結果..我只只需要最短的持續時間和相應的名稱。所以2行試圖獲得最小和最大與相應的名稱
從預約表SELECT
Min(Appointment.Appointment_duration) AS MINOfAppointment_duration,
Max(Appointment.Appointment_duration) AS MAXOfAppointment_duration,
mechanic_Firstname, mechanic_lastname, customer_firstname, customer_lastname
FROM Appointment, mechanic, Customer
WHERE (mechanic.mechanic_ID=Appointment.mechanic_ID) AND (customer.customer_ID=Appointment.customer_ID);
記錄
Appointment_ID Appointment_DATE Appointment_Duration Mechanic_ID Customer_ID
12 08/01/2007 0:35:00 1 5684
13 01/01/2009 2:15:36 6 2534
14 06/12/2010 0:05:29 7 7423
你可以提供樣本記錄嗎? – 2013-03-25 06:25:56
包括預約表, – 2013-03-25 06:42:07