`aksessuar_up`
id (auto increment) model model_id
50 15 100
51 17 102
52 19 105
53 15 106
`users_projects`
id (auto increment) model
10 5
11 7
12 9
13 1
我想将表格aksessuar_up
复制到表格users_projects_aks
。复制时我只想将users_projects(id)
复制到users_projects_aks(model_id)
。下面的查询无法正常工作,我尝试使用INNER JOIN和CROSS JOIN,但没有得到任何结果。
INSERT INTO
users_projects_aks (model, model_id)
SELECT
au.model, up.id
FROM
aksessuar_up as au,
users_projects as up;
我希望在复制后得到这个结果:
`users_projects_aks`
id (auto increment) model model_id
1 15 10
2 17 11
3 19 12
4 15 13
您可以看到model_id
适合users_projects(id)