sql子查询可从6个表连接中获取夏季报告

时间:2019-07-18 13:38:24

标签: mysql sql

我想通过加入6个表格来生成夏季报告

  1. 类别包含投资领域(矿产,农业,建筑等)的列表

  2. 投资内容包含许可编号,投资者ID,类别ID

  3. 投资者包含性别,investor_id,姓名..

  4. investment_details联系人investment_id,proposed_investment_amount,real_invested_amount,proposed_male_employment,proposed_female_employment,real_male_employment real_female_employment

  5. investment_status持有investment_detail_id和project_status_id

  6. project_status保留project_status_id和说明(pre-implementation, implementation, operation, canceled

我的报告预计会生成mineral, agricultural, constructionmale的类别(针对female),投资额(取决于if project status is operation sum of real_invested_amount else proposed_investment_amount)就业(取决于{{ 1}})和项目状态计数(每个project status is operation sum of real_male_employment+real_female_employment else proposed_male_employment+proposed_female_employment)。

enter image description here

任何有效的提示或代码将不胜感激

我的sql表和插入数据如下

pre-implementation, implementation, operation, canceled

0 个答案:

没有答案