profile_table
profile_id profile_name Profile_description
1 VINU ADMIN
profile_description表
calc_id proile_calc profile_result
1 20 45
2 30 43
3 42 82
我想要结果......
profile_id profile_name Profile_description calc_id proile_calc profile_result
1 VINU ADMIN 1 20 45
2 30 43
3 42 82
请帮助..........
答案 0 :(得分:0)
会是这样的:
SELECT pt.profile_id, pt.profile_name , pt.Profile_description, pd.calc_id , pd.proile_calc, pd.profile_result FROM profile_table as pt LEFT JOIN profile_description as pd ON pt.profile_id = pd.calc_id;
或
SELECT profile_table.profile_id, profile_table.profile_name , profile_table.Profile_description, profile_description.calc_id , profile_description.proile_calc, profile_description.profile_result FROM profile_table LEFT JOIN profile_description ON profile_table.profile_id = profile_description.calc_id;
答案 1 :(得分:0)
Table is poorly design. No FK in profile_description table. but if i suppose calc_id is FK
in profile_description table then
this query will help you.
SELECT `profile_table`.*,`profile_description`.*
FROM profile_table
RIGHT JOIN profile_description
ON profile_table.profile_id=profile_description.calc_id