我遇到了一个问题:
我想在电视广告项目(P300)中加入Joy Davies,费用为800.
我需要在PALLOCATION
表中更改此内容。
表名:EMPLOYEE
Emp_id | Emp_name | Address | Area of Expertise ========================================================================== 123456 | Kayleigh Donald | 23 LakeAvenue | Script writing 123457 | Fiaz Hussain | 12 Riverside Drive | Production 123458 | Debbie Jackson | 17 Long Road | Design 123459 | Melissa Jefferies | 45 The High Street | Design 123460 | Nirmal Singh | 34 East Street | Script writing 123461 | Joy Davies | 76 Broadway | Storyboarding 123462 | Daniel Ortez | 23 The Green | Production
表名:PALLOCATION
Emp_id | PROJECT_ID | STAFF_COST ============================================== 123456 | P300 | 900 123457 | P300 | 1500 123456 | D400 | 2000 123458 | D400 | 400 123458 | P200 | 350 123460 | P200 | 800 123462 | P200 | 400
表名:PROJECTS
PROJECT_ID | Project_name | Client ============================================== P300 | TV Ad | GSK D400 | Billboard Ad | GSK P200 | Radio Ad | Prontaprint
我试图通过使用这个sql实现这一点。
INSERT INTO Pallocation (Emp_id, Project_id, Staff_cost)
VALUES ('123461', 'P300', '800')
FROM Pallocation JOIN Employee ON Emp_id E = Emp_id Pa
JOIN Project ON Project_id Pr = Project id Pa
WHERE Emp_name...
我意识到这似乎是错的。请你指导我一下吗?
谢谢
答案 0 :(得分:0)
您不需要FROM
标准插入语法是
INSERT INTO table_name
VALUES (value1,value2,value3,...);
所以你只需要:
INSERT INTO Pallocation (Emp_id, Project_id, Staff_cost)
VALUES ('123461', 'P300', '800');
答案 1 :(得分:0)
只检查空值以确保数据完整性
if (Request::isMethod('get'))
{
//Here you can add your custom exception.
}