SELECT
ticketDescription,ticketTimeDate,ticketCategory,ticketServerity,user.userLocation,user.userFirstNames,user.userSurname,user.userDepartment,user.userContactNumber,user.userEmailAddress
FROM ticket
LEFT JOIN ticketHistory ON
ticket.ticketID = ticketHistory.ticketID
LEFT JOIN technician ON
ticketHistory.technicianID = technician.technicianID
LEFT JOIN user ON
ticket.userID = user.userID
WHERE ticketResolved = '0'
AND technician.technicianID = '1'
我正在尝试替换sql查询根据技术人员ID返回结果的整数。 (最后一行)。我想用来自用户将填写的html表单上的文本框中的值替换“1”,然后单击“提交”。然后html表单的操作会将文本框中的值放入AND technician.technicianID =' **',其中文本框的值将替换** 。
看起来很简单,但完全让我难过!
答案 0 :(得分:0)
你可以这样做:
set @input1=1;
SELECT
ticketDescription,ticketTimeDate,ticketCategory,ticketServerity,user.userLocation,user.userFirstNames,user.userSurname,user.userDepartment,user.userContactNumber,user.userEmailAddress
FROM ticket
LEFT JOIN ticketHistory ON
ticket.ticketID = ticketHistory.ticketID
LEFT JOIN technician ON
ticketHistory.technicianID = technician.technicianID
LEFT JOIN user ON
ticket.userID = user.userID
WHERE ticketResolved = '0'
AND technician.technicianID = @input1;