SELECT t.group_id, (@item_id := @item_id + 1), t.item_name, t.item_number FROM ( SELECT group_id, item_name, item_number FROM some_table ORDER BY group_id ) t GROUP BY t.group_id;这个报错some_table不存在

时间: 2024-04-05 17:31:48 浏览: 127
这个错误提示表名 "some_table" 不存在。这个错误通常是由于以下原因之一引起的: 1. 表名输入错误:请检查表名是否正确,并确保没有拼写错误或语法错误。 2. 数据库中不存在该表:请确保您正在连接到正确的数据库,并检查该表是否存在。 3. 命名空间问题:某些数据库需要在表名前面添加命名空间。请检查您的数据库是否需要这样做。 请您仔细检查上述原因,找到错误的根源并进行修复。
相关问题

SELECT count( 0 ) FROM ( SELECT so.inventory_id AS dealUserId, so.inventory_name AS handlers, count( 0 ) AS secondNum, ( SELECT count( 0 ) FROM t_order_repair_item WHERE inventory_id = so.inventory_id ) AS totalCount FROM t_sub_order a LEFT JOIN t_order_repair_item so ON so.sub_order_id = a.sub_order_id WHERE a.repair_repeat = 1 AND so.inventory_id IS NOT NULL AND a.sls_name IN ( SELECT sls_name FROM t_sls_name WHERE sls_model_id IN ( 13, 14, 15 ) AND state = 0 AND del_flag = 0 ) GROUP BY so.inventory_id ) t 优化这条sql

这条SQL语句的性能瓶颈可能在于子查询和GROUP BY操作。以下是一些优化建议: 1. 避免使用子查询,可以使用JOIN操作代替。例如: ``` SELECT so.inventory_id AS dealUserId, so.inventory_name AS handlers, COUNT(0) AS secondNum, COUNT(DISTINCT sri.repair_item_id) AS totalCount FROM t_sub_order a LEFT JOIN t_order_repair_item so ON so.sub_order_id = a.sub_order_id LEFT JOIN t_order_repair_item sri ON sri.inventory_id = so.inventory_id JOIN t_sls_name sn ON a.sls_name = sn.sls_name WHERE a.repair_repeat = 1 AND so.inventory_id IS NOT NULL AND sn.sls_model_id IN (13, 14, 15) AND sn.state = 0 AND sn.del_flag = 0 GROUP BY so.inventory_id, so.inventory_name; ``` 2. 尽量避免使用函数,例如COUNT(0)可以写成COUNT(*),可以提高性能。 3. 考虑创建适当的索引以加快查询速度。在这种情况下,可以考虑创建以下索引: ``` t_sub_order(repair_repeat, sls_name) t_order_repair_item(sub_order_id, inventory_id) t_order_repair_item(inventory_id) t_sls_name(sls_name, sls_model_id, state, del_flag) ``` 通过这些优化,应该能够提高查询性能。

SELECT a.item_id, a.item_name, a.method_id, a.method_name, a.std_id, a.std_name, c.period, c.unit, c.db, d.stability_sub_scheme_code, d.inspection_type_id, e.scheme_code, e.scheme_name, d.placement_direction, g.dept_id FROM taskregistration_sample_item a INNER JOIN stability2_stability_scheme_period_item b ON a.rd = b.stability_sub_scheme_id INNER JOIN stability2_stability_scheme_period c ON b.stability_sub_scheme_id = c.stability_sub_scheme_id INNER JOIN stability2_stability_sub_schem d ON c.stability_sub_scheme_id = d.id INNER JOIN stability2_stability_schem e ON d.stability_scheme_id =e.id LEFT JOIN samplereceive_sample_assign_item_detail f ON a.id=f.sample_item_id LEFT JOIN samplereceive_sample_assign g ON f.assign_id=g.id WHERE c.period_state="1" ORDER BY e.scheme_code, d.stability_sub_scheme_code, c.db, a.item_name GROUP BY a.id; 这个SQL有问题嘛

根据您提供的SQL查询语句,我没有发现明显的语法错误。但是,您可能需要注意以下几点: 1. 在SELECT子句中,您使用了GROUP BY子句,但是没有使用聚合函数(例如SUM,COUNT等)。这可能导致在一些数据库管理系统中出现错误。如果您不需要使用聚合函数,请考虑删除GROUP BY子句。 2. 根据您的需求,您可能需要检查JOIN条件是否正确连接了所有表,并且每个表之间的关联是正确的。请确保表之间的关联字段正确匹配。 3. 在WHERE子句中,您使用了"c.period_state = '1'"条件。请确保该条件在数据库中有意义,并且该字段是正确的。 4. 在ORDER BY子句中,您使用了多个列进行排序。请确保这些列在查询的结果集中存在,并且指定的列名是正确的。 请注意,我只能提供语法和逻辑上的一般建议,具体问题还需要根据您的数据库结构和数据来进行调试和优化。
阅读全文

相关推荐

优化这个sql SELECT count( 1 ) FROM ( SELECT B.ID, B.PURCHASE_REQUEST_ID, B.MATERIAL_ID, B.MATERIAL_CODE, B.MATERIAL_NAME, B.STANDARD, B.MODEL_ID, B.BILL_ROW_ID, B.BILL_NO, BILL_NAME, B.MODEL_CODE, B.MODEL_NAME, B.PARENT_MODEL_ID, B.PARENT_MODEL_CODE, B.PARENT_MODEL_NAME, B.UNIT_CODE, B.UNIT_NAME, B.PURCHASE_TYPE_CODE, CAST( NVL( B.APPLY_NUM, 0 ) AS NUMBER ( 24, 10 ) ) AS APPLY_NUM, CAST( NVL( B.DEAL_NUM, 0 ) AS NUMBER ( 24, 10 ) ) AS DEAL_NUM, CAST( NVL( B.RETURN_NUM, 0 ) AS NUMBER ( 24, 10 ) ) AS RETURN_NUM, B.DEAL_USER_ID, B.DEAL_USER_NAME, CAST( NVL( B.PRICE, 0 ) AS NUMBER ( 24, 10 ) ) AS PRICE, CAST( NVL( B.AMOUNT, 0 ) AS NUMBER ( 24, 10 ) ) AMOUNT, B.IMPLEMENT_CODE, B.IMPLEMENT_NAME, B.IMPLEMENT_INVEST_AMOUNT, B.PURCHASE_MANAGER_ID, B.PURCHASE_MANAGER_NAME, B.PROVIDER_ID, B.PROVIDER_NAME, B.REMARK, B.DELIVER_AREA, B.DELIVER_ADDRESS, B.RECEIVE_PEOPLE, B.RECEIVE_PEOPLE_PHONE, B.ITEM_STATUS, B.COST_CENTER, B.COST_BUDGET_CODE, B.COST_IMPLEMENT_NAME, B.FRAME_CONT_ID, B.FRAME_CONT_CODE, B.FRAME_CONT_NAME, B.DETAIL_CONFIG, B.PURCHASE_CATEGORY_CODE, B.INVOICE_TITLE_CODE, B.INVOICE_SEND_ADDRRSS, B.MATERIAL_REQUEST_ITEM_ID, B.YEAR, B.DELETE_FLAG, B.PROVINCE_CODE, B.REASON, B.PARENT_ITEM_ID, B.FRAME_CONT_ITEM_ID, B.SUB_MATERIAL_REQUEST_ID, B.SUB_MATERIAL_REQUEST_CODE, B.MATERIAL_URL, B.RECOMMEND_PROVIDER_NAMES, C.PURCHASE_REQUEST_CODE, C.PURCHASE_REQUEST_NAME, C.APPLY_TYPE_CODE, C.CREATOR_NAME, C.APPLY_TELEPHONE, C.COMPANY_NAME, C.DEPT_NAME, B.CREATE_TIME, TO_CHAR( B.CREATE_TIME, 'YYYY-MM-DD' ) CREATE_TIME_STR, C.ARRIVE_TIME, C.IS_TO_END, C.MONEY_WAY_CODE, C.OWN, C.APPLY_CATEGORY_CODE, C.manu_Type, C.BILL_ID, MMD.MATERIAL_TYPE_CODE, B.BRANCH_COMPANY_DEAL_USER_ID, B.BRANCH_COMPANY_DEAL_USER_NAME, ( SELECT ORG_NAME FROM ORGANIZATIONS WHERE DELETE_FLAG = '0' AND ORG_CODE = ( SELECT PARENT_COMPANY_NO FROM ORGANIZATIONS WHERE ID = B.MATERIAL_DEPT_ID )) AS MATERIAL_COMPANY_NAME, B.ORIGINAL, B.PROVIDER_PRODUCT_MODEL, B.PROVIDER_PRODUCT_NAME, B.PRODUCT_DESC, B.Back_Flag, CASE WHEN MMD.material_type_code = 'WZ' THEN '1' WHEN MMD.material_type_code = 'FW' THEN '2' ELSE '3' END apply_category_code_item, NVL( C.IS_CARDSYSTEM_REQUEST, '0' ) IS_CARDSYSTEM_REQUEST, B.APPLY_GROUP_AUTHORITES, B.SCIENTIFIC_RESEARCH_ID, B.SCIENTIFIC_RESEARCH_CODE, B.SCIENTIFIC_RESEARCH_NAME, B.PREQUALFY_CODE, nvl( C.IS_QUICK, '0' ) AS IS_QUICK, C.PURCHASE_WAY_CODE, C.PURCHASE_TYPE_CODE PURCHASE_TYPE_CODE_P, C.ORIGINAL_TYPE, C.PURCHASE_REQUEST_BILLS_TYPE, B.IS_FRAME_CONT_MONAD FROM PURCHASE_REQUEST_ITEM B LEFT JOIN PURCHASE_REQUEST C ON B.PURCHASE_REQUEST_ID = C.ID LEFT JOIN MATERIAL_DATA MMD ON MMD.ID = B.MATERIAL_ID AND MMD.DELETE_FLAG = '0' WHERE B.delete_flag = '0' AND B.Item_Status IN ( 1 ) AND NOT EXISTS ( SELECT * FROM purchase_request_item_log pril WHERE B.id = pril.purchase_request_item_id AND pril.lock_status = '1' AND pril.delete_flag = '0' ) AND ( ( c.apply_type_code NOT IN ( '20', '41', '3' ) AND nvl( B.Apply_Num, 0 ) > nvl( B.Deal_Num, 0 )) OR c.apply_type_code IN ( '20', '41', '3' ) ) AND B.Deal_User_Id =: 1 AND C.MONEY_WAY_CODE =: 2 AND C.APPLY_TYPE_CODE =: 3 AND C.PAY_OUT_TYPE_CODE =: 4 AND C.APPLY_CATEGORY_CODE =: 5 AND NVL( C.IS_CARDSYSTEM_REQUEST, '0' ) = : 6 AND NOT EXISTS ( SELECT * FROM purchase_request_item p left join material_province mp ON p.material_id = mp.material_id WHERE p.delete_flag = 0 AND mp.delete_flag = 0 AND mp.material_status = 03 AND mp.org_code = p.province_code AND p.id = B.id ) ORDER BY C.ID, B.ID ASC)

SELECT bs.report_no, bs.sample_id, bs.test_id, bs.service_type, bs.sample_name, bs.total_fee, bs.receivable_fee, bs.sample_no, bs.ranges, bs.grade, bs.sample_remark AS remark, bs.factory, bs.item_name, bs.apply_dept, bs.specification, bs.factory_number, bs.calibrat_point, bs.mandatory_flag, bs.inspection_type, bs.report_org_name, bs.plan_complete_date, bs.standard_instrument_name, bs.bleeding_site_name, bs.arrive_date, DATEDIFF( bs.plan_complete_date, NOW()) AS surplus_days, bs.order_no, bs.order_type, bs.customer_name, bs.order_id, bs.business_type, bs.group_id, bs.group_name, bs.item_id, bs.is_merge, bs.pass_time, bs.audit_time, bs.report_id, bs.compile_time, bs.generate_time, bs.pass_user_name, bs.audit_user_name, bs.compile_user_name, bs.report_state, bs.is_just_certificate, bs.label_price, bs.labor_cost, bs.product_type, bs.batch_number, bs.original_number, bs.type_no, bs.template_id, bs.template_version, bs.standard_instrument_id, bs.standard_instrument_name, bs.report_query_code, bs.test_user_id, bs.test_user_name, bs.test_time, bs.review_user_id, bs.review_user_name, bs.review_time, bs.or_number, bs.test_result, bs.test_result_text, bs.test_date, bs.test_address, bs.result_value, bs.unit, bs.test_dept_id, bs.test_dept_name, bs.sample_mass, bs.form, bs.color, bs.clarity, bs.amplification_detection, bs.precious_metal, bs.remarks, bs.photo, bs.identifying_code, bs.diamond_quality, bs.hand_ring, bs.craft, bs.instrument_photo, bs.customer_item_basis, bs.quality_photo, bs.check_point, bs.check_code, bs.mass_unit, bs.manufacturer_name, bs.manufacturer_addr, bs.result_sample_describe AS sampleDescribe, bs.test_rule AS metalRuleIdsStr, bsa.attach_id FROM view_sample_info bs JOIN bus_sample_report bsr ON bs.report_id = bsr.id JOIN bus_sample sa ON bsr.sample_id = sa.id JOIN bus_sample_attr bsa ON sa.id = bsa.id 需要按照bs.report_no 的整数来从小到大进行排序

将下面这条sql语句简化一下:SELECT * FROM ( SELECT fpd.fpd_id AS fpdId, fpd.fpd_budget_project AS fpdBudgetProject, fpd.fpd_budget_project_id AS fpdBudgetProjectId, fpd.fpd_pf_name AS fpdPfName, fpd.fpd_pf_id AS fpdPfId, fpd.fpd_expend_subject AS fpdExpendSubject, fpd.fpd_expend_subject_id AS fpdExpendSubjectId, fpd.fpd_payee_name AS fpdPayeeName, fpd.fpd_payee_account AS fpdPayeeAccount, fpd.fpd_payee_opening_bank AS fpdPayeeOpeningBank, fpd.fpd_payee_opening_bank_num AS fpdPayeeOpeningBankNum, fpd.fpd_dept_pay_economics_classify_num AS fpdDeptPayEconomicsClassifyNum, fpd.fpd_dept_pay_economics_classify_name AS fpdDeptPayEconomicsClassifyName, fpd.fpd_applied_amount AS fpdAppliedAmount, fpd.fpd_capital_use AS fpdCapitalUse, fpd.fpd_postscript AS fpdPostscript, fpd.fpd_budget_item_name AS fpdBudgetItemName, fpd.fpd_budget_item_number AS fpdBudgetItemNumber, fpd.fpd_dr_name AS fpdDrName, dbec.dbec_parent_num AS dbecParentNum FROM financial_payment_details fpd LEFT JOIN dept_budget_economy_class dbec ON fpd.fpd_dept_pay_economics_classify_num = dbec.dbec_num WHERE fpd.fpd_is_tax = "0" UNION ALL SELECT fpd.fpd_id AS fpdId, fpd.fpd_budget_project AS fpdBudgetProject, fpd.fpd_budget_project_id AS fpdBudgetProjectId, fpd.fpd_pf_name AS fpdPfName, fpd.fpd_pf_id AS fpdPfId, fpd.fpd_expend_subject AS fpdExpendSubject, fpd.fpd_expend_subject_id AS fpdExpendSubjectId, fpd.fpd_payee_name AS fpdPayeeName, fpd.fpd_payee_account AS fpdPayeeAccount, fpd.fpd_payee_opening_bank AS fpdPayeeOpeningBank, fpd.fpd_payee_opening_bank_num AS fpdPayeeOpeningBankNum, fpd.fpd_dept_pay_economics_classify_num AS fpdDeptPayEconomicsClassifyNum, fpd.fpd_dept_pay_economics_classify_name AS fpdDeptPayEconomicsClassifyName, sum( fpd.fpd_applied_amount ) AS fpdAppliedAmount, fpd.fpd_capital_use AS fpdCapitalUse, fpd.fpd_postscript AS fpdPostscript, fpd.fpd_budget_item_name AS fpdBudgetItemName, fpd.fpd_budget_item_number AS fpdBudgetItemNumber, fpd.fpd_dr_name AS fpdDrName, dbec.dbec_parent_num AS dbecParentNum FROM financial_payment_details fpd LEFT JOIN dept_budget_economy_class dbec ON fpd.fpd_dept_pay_economics_classify_num = dbec.dbec_num WHERE fpd.fpd_is_tax = "1" GROUP BY fpd_pay_num ) t1

将下面这条sql语句简短一些:SELECT * FROM ( SELECT fpd.fpd_id AS fpdId, fpd.fpd_budget_project AS fpdBudgetProject, fpd.fpd_budget_project_id AS fpdBudgetProjectId, fpd.fpd_pf_name AS fpdPfName, fpd.fpd_pf_id AS fpdPfId, fpd.fpd_expend_subject AS fpdExpendSubject, fpd.fpd_expend_subject_id AS fpdExpendSubjectId, fpd.fpd_payee_name AS fpdPayeeName, fpd.fpd_payee_account AS fpdPayeeAccount, fpd.fpd_payee_opening_bank AS fpdPayeeOpeningBank, fpd.fpd_payee_opening_bank_num AS fpdPayeeOpeningBankNum, fpd.fpd_dept_pay_economics_classify_num AS fpdDeptPayEconomicsClassifyNum, fpd.fpd_dept_pay_economics_classify_name AS fpdDeptPayEconomicsClassifyName, fpd.fpd_applied_amount AS fpdAppliedAmount, fpd.fpd_capital_use AS fpdCapitalUse, fpd.fpd_postscript AS fpdPostscript, fpd.fpd_budget_item_name AS fpdBudgetItemName, fpd.fpd_budget_item_number AS fpdBudgetItemNumber, fpd.fpd_dr_name AS fpdDrName, dbec.dbec_parent_num AS dbecParentNum FROM financial_payment_details fpd LEFT JOIN dept_budget_economy_class dbec ON fpd.fpd_dept_pay_economics_classify_num = dbec.dbec_num WHERE fpd.fpd_is_tax = "0" UNION ALL SELECT fpd.fpd_id AS fpdId, fpd.fpd_budget_project AS fpdBudgetProject, fpd.fpd_budget_project_id AS fpdBudgetProjectId, fpd.fpd_pf_name AS fpdPfName, fpd.fpd_pf_id AS fpdPfId, fpd.fpd_expend_subject AS fpdExpendSubject, fpd.fpd_expend_subject_id AS fpdExpendSubjectId, fpd.fpd_payee_name AS fpdPayeeName, fpd.fpd_payee_account AS fpdPayeeAccount, fpd.fpd_payee_opening_bank AS fpdPayeeOpeningBank, fpd.fpd_payee_opening_bank_num AS fpdPayeeOpeningBankNum, fpd.fpd_dept_pay_economics_classify_num AS fpdDeptPayEconomicsClassifyNum, fpd.fpd_dept_pay_economics_classify_name AS fpdDeptPayEconomicsClassifyName, sum( fpd.fpd_applied_amount ) AS fpdAppliedAmount, fpd.fpd_capital_use AS fpdCapitalUse, fpd.fpd_postscript AS fpdPostscript, fpd.fpd_budget_item_name AS fpdBudgetItemName, fpd.fpd_budget_item_number AS fpdBudgetItemNumber, fpd.fpd_dr_name AS fpdDrName, dbec.dbec_parent_num AS dbecParentNum FROM financial_payment_details fpd LEFT JOIN dept_budget_economy_class dbec ON fpd.fpd_dept_pay_economics_classify_num = dbec.dbec_num WHERE fpd.fpd_is_tax = "1" GROUP BY fpd_pay_num ) t1

将下面这条sql语句优化简短一些 :SELECT * FROM ( SELECT fpd.fpd_id AS fpdId, fpd.fpd_budget_project AS fpdBudgetProject, fpd.fpd_budget_project_id AS fpdBudgetProjectId, fpd.fpd_pf_name AS fpdPfName, fpd.fpd_pf_id AS fpdPfId, fpd.fpd_expend_subject AS fpdExpendSubject, fpd.fpd_expend_subject_id AS fpdExpendSubjectId, fpd.fpd_payee_name AS fpdPayeeName, fpd.fpd_payee_account AS fpdPayeeAccount, fpd.fpd_payee_opening_bank AS fpdPayeeOpeningBank, fpd.fpd_payee_opening_bank_num AS fpdPayeeOpeningBankNum, fpd.fpd_dept_pay_economics_classify_num AS fpdDeptPayEconomicsClassifyNum, fpd.fpd_dept_pay_economics_classify_name AS fpdDeptPayEconomicsClassifyName, fpd.fpd_applied_amount AS fpdAppliedAmount, fpd.fpd_capital_use AS fpdCapitalUse, fpd.fpd_postscript AS fpdPostscript, fpd.fpd_budget_item_name AS fpdBudgetItemName, fpd.fpd_budget_item_number AS fpdBudgetItemNumber, fpd.fpd_dr_name AS fpdDrName, dbec.dbec_parent_num AS dbecParentNum FROM financial_payment_details fpd LEFT JOIN dept_budget_economy_class dbec ON fpd.fpd_dept_pay_economics_classify_num = dbec.dbec_num WHERE fpd.fpd_is_tax = "0" UNION ALL SELECT fpd.fpd_id AS fpdId, fpd.fpd_budget_project AS fpdBudgetProject, fpd.fpd_budget_project_id AS fpdBudgetProjectId, fpd.fpd_pf_name AS fpdPfName, fpd.fpd_pf_id AS fpdPfId, fpd.fpd_expend_subject AS fpdExpendSubject, fpd.fpd_expend_subject_id AS fpdExpendSubjectId, fpd.fpd_payee_name AS fpdPayeeName, fpd.fpd_payee_account AS fpdPayeeAccount, fpd.fpd_payee_opening_bank AS fpdPayeeOpeningBank, fpd.fpd_payee_opening_bank_num AS fpdPayeeOpeningBankNum, fpd.fpd_dept_pay_economics_classify_num AS fpdDeptPayEconomicsClassifyNum, fpd.fpd_dept_pay_economics_classify_name AS fpdDeptPayEconomicsClassifyName, sum( fpd.fpd_applied_amount ) AS fpdAppliedAmount, fpd.fpd_capital_use AS fpdCapitalUse, fpd.fpd_postscript AS fpdPostscript, fpd.fpd_budget_item_name AS fpdBudgetItemName, fpd.fpd_budget_item_number AS fpdBudgetItemNumber, fpd.fpd_dr_name AS fpdDrName, dbec.dbec_parent_num AS dbecParentNum FROM financial_payment_details fpd LEFT JOIN dept_budget_economy_class dbec ON fpd.fpd_dept_pay_economics_classify_num = dbec.dbec_num WHERE fpd.fpd_is_tax = "1" GROUP BY fpd_pay_num ) t1

使其简短些 SELECT * FROM ( SELECT fpd.fpd_id AS fpdId, fpd.fpd_budget_project AS fpdBudgetProject, fpd.fpd_budget_project_id AS fpdBudgetProjectId, fpd.fpd_pf_name AS fpdPfName, fpd.fpd_pf_id AS fpdPfId, fpd.fpd_expend_subject AS fpdExpendSubject, fpd.fpd_expend_subject_id AS fpdExpendSubjectId, fpd.fpd_payee_name AS fpdPayeeName, fpd.fpd_payee_account AS fpdPayeeAccount, fpd.fpd_payee_opening_bank AS fpdPayeeOpeningBank, fpd.fpd_payee_opening_bank_num AS fpdPayeeOpeningBankNum, fpd.fpd_dept_pay_economics_classify_num AS fpdDeptPayEconomicsClassifyNum, fpd.fpd_dept_pay_economics_classify_name AS fpdDeptPayEconomicsClassifyName, fpd.fpd_applied_amount AS fpdAppliedAmount, fpd.fpd_capital_use AS fpdCapitalUse, fpd.fpd_postscript AS fpdPostscript, fpd.fpd_budget_item_name AS fpdBudgetItemName, fpd.fpd_budget_item_number AS fpdBudgetItemNumber, fpd.fpd_dr_name AS fpdDrName, dbec.dbec_parent_num AS dbecParentNum FROM financial_payment_details fpd LEFT JOIN dept_budget_economy_class dbec ON fpd.fpd_dept_pay_economics_classify_num = dbec.dbec_num WHERE fpd.fpd_is_tax = "0" UNION ALL SELECT fpd.fpd_id AS fpdId, fpd.fpd_budget_project AS fpdBudgetProject, fpd.fpd_budget_project_id AS fpdBudgetProjectId, fpd.fpd_pf_name AS fpdPfName, fpd.fpd_pf_id AS fpdPfId, fpd.fpd_expend_subject AS fpdExpendSubject, fpd.fpd_expend_subject_id AS fpdExpendSubjectId, fpd.fpd_payee_name AS fpdPayeeName, fpd.fpd_payee_account AS fpdPayeeAccount, fpd.fpd_payee_opening_bank AS fpdPayeeOpeningBank, fpd.fpd_payee_opening_bank_num AS fpdPayeeOpeningBankNum, fpd.fpd_dept_pay_economics_classify_num AS fpdDeptPayEconomicsClassifyNum, fpd.fpd_dept_pay_economics_classify_name AS fpdDeptPayEconomicsClassifyName, sum( fpd.fpd_applied_amount ) AS fpdAppliedAmount, fpd.fpd_capital_use AS fpdCapitalUse, fpd.fpd_postscript AS fpdPostscript, fpd.fpd_budget_item_name AS fpdBudgetItemName, fpd.fpd_budget_item_number AS fpdBudgetItemNumber, fpd.fpd_dr_name AS fpdDrName, dbec.dbec_parent_num AS dbecParentNum FROM financial_payment_details fpd LEFT JOIN dept_budget_economy_class dbec ON fpd.fpd_dept_pay_economics_classify_num = dbec.dbec_num WHERE fpd.fpd_is_tax = "1" GROUP BY fpd_pay_num ) t1

SELECT bs.sample_id, bs.item_id, bs.report_id, bs.order_no, bs.order_id, bs.order_business_type, bs.commission_date, bs.customer_name, bs.applicant, bs.phone, bs.receive_user_name, bs.contract_no, bs.special_requirements, bs.report_org_name, bs.report_org_address, bs.sample_name, bs.standard_instrument_name, bs.complete_day, bs.sample_remark AS remark, bs.standard_instrument_id, bs.sample_no, bs.factory_number, bs.item_name, /*bs.item_quantity,*/ bs.inspection_type, bs.mandatory_flag, bs.test_quantity, bs.sample_state, bs.current_site, bs.plan_complete_date, bs.affix, bs.ranges, bs.grade, bs.factory, bs.calibrat_point, bs.apply_dept, bs.specification, bs.final_fee, bs.service_type, CASE WHEN bs.actual_complete_date IS NOT NULL THEN DATEDIFF( bs.plan_complete_date, bs.actual_complete_date ) ELSE datediff( bs.plan_complete_date, now()) END AS surplus_days, bs.report_no, bs.is_report_back, bs.back_reason AS report_back_reason, bs.is_just_certificate, bs.report_state, bs.temper, bs.humidity, bs.test_result, bs.test_date, bs.next_test_date, bs.test_cycle, bs.test_address, bs.generate_time, bs.point_report_id, bs.is_merge, bs.circulation_flag, bs.item_proposal_fee AS proposal_fee, bs.change_price_reason, bs.test_user_name, bs.group_id, bs.group_name, bs.charging_num, bs.other_fee, bs.receivable_fee, bs.affix_quantity, bs.test_org, bs.out_org_order_no, bs.out_org_sample_no, bs.business_user_name, bs.pdf_path, bs.settlement_state, bs.result_describe, bsa.attach_id FROM view_sample_info bs JOIN bus_sample_report bsr ON bs.report_id = bsr.id JOIN bus_sample sa ON bsr.sample_id = sa.id JOIN bus_sample_attr bsa ON sa.id = bsa.id 根据bs.commission_date 进行排序最近的排上面 bs.commission_date

优化SQL select round( ohbmc.after_actual_amount/zz,0) cost_moneyi ,count(distinct case when ddp.orig_plan_rid = -1 then null else ddp.orig_plan_rid end) AS orig_num ,array_agg (dlt.state) AS loading_state ,count(DISTINCT CASE WHEN ddp.sale_planid = -1 THEN NULL ELSE ddp.sale_planid END) AS saleid_num--销地已计划数量 ,array_agg(dto.state) AS saletransport_state from ( SELECT id AS origin_planid , unnest(cabinet_rule_id) cabinet_rule_id -- 判断 next_plan_id 本身是空和 next_plan_id 为 {} ,unnest(case when (next_plan_id is null or next_plan_id[1] is null) then ARRAY[-1]::integer[] else next_plan_id end) as sale_planid --销地计划 , case when dp.plan_receiver_id is null then -1 else dp.plan_receiver_id end orig_plan_rid --产地计划 FROM ods.ods_durian_delivery_plan as dp left join ods.ods_hl_commodity_category as hcc on hcc.category_id = dp.category_id WHERE dp.type = 'ORIGIN' AND dp.deleted = 99 AND dp.tenant_id = 1 and cabinet_rule_id='{8}'or cabinet_rule_id='{9}'or cabinet_rule_id='{10000005}'---取白心火龙果 AND hcc.category_name = '火龙果') as ddp LEFT JOIN ods.ods_durian_loading_task AS dlt ON dlt.plan_id = ddp.origin_planid and dlt.plan_type='ORIGIN' AND dlt.deleted = 99 LEFT JOIN ods.ods_durian_transport_order AS dto ON dto.plan_id = ddp.sale_planid AND dto.deleted = 99 LEFT JOIN ods.ods_durian_receipt_task AS drt ON drt.plan_id = ddp.sale_planid AND drt.deleted = 99 LEFT JOIN ods.ods_durian_transport_order AS dto1 ON dto1.plan_id = ddp.sale_planid AND dto1.sort_no = 1 AND dto1.deleted = 99 left join (select odlsi.plan_id,sum(odlsi.quantity) zz from ods.ods_durian_loading_sku_item odlsi group by 1) odlsi on odlsi.plan_id=dlt.plan_id left join (select *, unnest(case when ( odbr.bill_main_id is null or odbr.bill_main_id is null) then ARRAY[-1]::integer[] else odbr.bill_main_id end) bill_main_id_r from ods.ods_durian_bill_rel odbr) odbr on odbr.data_id= dlt.plan_id and odbr.data_type='ORIGIN_FEE' left join ods.ods_hl_bill_main_currency ohbmc on ohbmc.bill_main_id=odbr.bill_main_id_r and ohbmc.deleted=99 group by 1;

insert table cdata_safe_income_new_day_analysis_item_status with t1 as ( select if(a.app_id is null,b.app_id,a.app_id) as app_id, if(a.product is null,b.product,a.product) as product, if(a.item_code_name is null,b.item_code_name,a.item_code_name) as item_code_name, case when a.app_id is null and (if(a.tiaozhang_cnt is null,0,a.tiaozhang_cnt) + if(b.tiaozhang_cnt is null,0,b.tiaozhang_cnt)) > 0 then '调账影响' when b.app_id is null and (if(a.tiaozhang_cnt is null,0,a.tiaozhang_cnt) + if(b.tiaozhang_cnt is null,0,b.tiaozhang_cnt)) > 0 then '调账影响' when a.app_id is null and (if(a.tuifei_cnt is null,0,a.tuifei_cnt) + if(b.tuifei_cnt is null,0,b.tuifei_cnt)) > 0 then '退费影响' when b.app_id is null and (if(a.tuifei_cnt is null,0,a.tuifei_cnt) + if(b.tuifei_cnt is null,0,b.tuifei_cnt)) > 0 then '退费影响' when a.app_id is null and c.voucher_begin > 0 then '优惠券影响' --- 原:续费使用了代金券 when a.app_id is null and c.voucher_end > 0 and change_order_cnt = 0 then '优惠券影响' --- 原:续费使用了代金券 when b.app_id is null and c.voucher_begin > 0 then '优惠券影响' --- 原:续费由代金券转为正常 when b.app_id is null and c.voucher_end > 0 and change_order_cnt = 0 then '优惠券影响' --- 原:续费由代金券转为正常 else 'item维度正常' end flag_status from (select app_id, product,item_code_name,sum(if(paymode_type = '调账',1,0)) as tiaozhang_cnt, sum(if(instr(paymode,'退费')>0,1,0)) as tuifei_cnt from cdata_safe_income_new_day where ftime = '${YYYYMMDD}' and paymode != '0元订单' and prod_class1_name = '基础安全' and prod_class2_name = '云原生安全' and product is not null and pay_type = '公有云' group by app_id,product,item_code_name ) a full join

帮我翻译以下代码 <select id="getStatisticalInfoDetailCount" resultType="java.lang.Integer"> select count()from(select psi.station_id,cda.cdc as count_device_code,cda.appkey from (select count(dci.device_code) as cdc,dci.appkey from iledproduction.device_code_info dci where CONV(left(dci.device_code,2),16,10) in <foreach collection="manufacturerIdList" item="item" index="index" open="(" close=")" separator=","> #{item} </foreach> <if test="propMap.size>0 and propMap!=null"> <foreach collection="propMap" index="index" item="item"> <if test='index.toString=="device_type"'> and substr(dci.device_code,3,4) = "${item[1]}" </if> <if test='index.toString=="produce_date"'> and STR_TO_DATE(substr(dci.device_code,7,6),'%y%m%d') BETWEEN "${item[1]}" AND DATE_ADD("${item[2]}",INTERVAL 1 DAY) </if> </foreach> </if> and dci.cert_import_status = 1 group by appkey) as cda left join (select s1.station_id as station_id,s1.old_appkey as appkey from iledproduction.appkey_log s1 union (select s2.station_id as station_id,s2.new_appkey as appkey from iledproduction.appkey_log s2) union (select s3.station_id as station_id,s3.appkey as appkey from iledproduction.production_station_info s3) ) psi on cda.appkey = psi.appkey) a left join (select p.,dpt.manufacturer_id,dpt.department_name from iledproduction.production_station_info p ,iledproduction.department dpt where p.department_key=dpt.department_key) ps on a.station_id = ps.station_id <if test="propMap.size>0 and propMap!=null"> <foreach collection="propMap" index="index" item="item"> <if test='index.toString=="manufacturer_id"'> where ps.manufacturer_id = ${item[1]} </if> </foreach> </if> </select>

最新推荐

recommend-type

S变换+Sockwell R G , Mansinha L , Lowe R P . Localization of the complex spectrum: the S transformJ

s变换用的高斯窗函数( 高斯窗是指数窗的一种,它也无负的旁瓣,而且没有旁瓣波动,因而不回引起计算谱中假的极大值或极小值,而且高斯窗频率窗函数的主瓣比指数窗的主瓣窄,分辨率比指数窗有所提高。
recommend-type

HTML挑战:30天技术学习之旅

资源摘要信息: "desafio-30dias" 标题 "desafio-30dias" 暗示这可能是一个与挑战或训练相关的项目,这在编程和学习新技能的上下文中相当常见。标题中的数字“30”很可能表明这个挑战涉及为期30天的时间框架。此外,由于标题是西班牙语,我们可以推测这个项目可能起源于或至少是针对西班牙语使用者的社区。标题本身没有透露技术上的具体内容,但挑战通常涉及一系列任务,旨在提升个人的某项技能或知识水平。 描述 "desafio-30dias" 并没有提供进一步的信息,它重复了标题的内容。因此,我们不能从中获得关于项目具体细节的额外信息。描述通常用于详细说明项目的性质、目标和期望成果,但由于这里没有具体描述,我们只能依靠标题和相关标签进行推测。 标签 "HTML" 表明这个挑战很可能与HTML(超文本标记语言)有关。HTML是构成网页和网页应用基础的标记语言,用于创建和定义内容的结构、格式和语义。由于标签指定了HTML,我们可以合理假设这个30天挑战的目的是学习或提升HTML技能。它可能包含创建网页、实现网页设计、理解HTML5的新特性等方面的任务。 压缩包子文件的文件名称列表 "desafio-30dias-master" 指向了一个可能包含挑战相关材料的压缩文件。文件名中的“master”表明这可能是一个主文件或包含最终版本材料的文件夹。通常,在版本控制系统如Git中,“master”分支代表项目的主分支,用于存放项目的稳定版本。考虑到这个文件名称的格式,它可能是一个包含所有相关文件和资源的ZIP或RAR压缩文件。 结合这些信息,我们可以推测,这个30天挑战可能涉及了一系列的编程任务和练习,旨在通过实践项目来提高对HTML的理解和应用能力。这些任务可能包括设计和开发静态和动态网页,学习如何使用HTML5增强网页的功能和用户体验,以及如何将HTML与CSS(层叠样式表)和JavaScript等其他技术结合,制作出丰富的交互式网站。 综上所述,这个项目可能是一个为期30天的HTML学习计划,设计给希望提升前端开发能力的开发者,尤其是那些对HTML基础和最新标准感兴趣的人。挑战可能包含了理论学习和实践练习,鼓励参与者通过构建实际项目来学习和巩固知识点。通过这样的学习过程,参与者可以提高在现代网页开发环境中的竞争力,为创建更加复杂和引人入胜的网页打下坚实的基础。
recommend-type

【CodeBlocks精通指南】:一步到位安装wxWidgets库(新手必备)

![【CodeBlocks精通指南】:一步到位安装wxWidgets库(新手必备)](https://www.debugpoint.com/wp-content/uploads/2020/07/wxwidgets.jpg) # 摘要 本文旨在为使用CodeBlocks和wxWidgets库的开发者提供详细的安装、配置、实践操作指南和性能优化建议。文章首先介绍了CodeBlocks和wxWidgets库的基本概念和安装流程,然后深入探讨了CodeBlocks的高级功能定制和wxWidgets的架构特性。随后,通过实践操作章节,指导读者如何创建和运行一个wxWidgets项目,包括界面设计、事件
recommend-type

andorid studio 配置ERROR: Cause: unable to find valid certification path to requested target

### 解决 Android Studio SSL 证书验证问题 当遇到 `unable to find valid certification path` 错误时,这通常意味着 Java 运行环境无法识别服务器提供的 SSL 证书。解决方案涉及更新本地的信任库或调整项目中的网络请求设置。 #### 方法一:安装自定义 CA 证书到 JDK 中 对于企业内部使用的私有 CA 颁发的证书,可以将其导入至 JRE 的信任库中: 1. 获取 `.crt` 或者 `.cer` 文件形式的企业根证书; 2. 使用命令行工具 keytool 将其加入 cacerts 文件内: ```
recommend-type

VC++实现文件顺序读写操作的技巧与实践

资源摘要信息:"vc++文件的顺序读写操作" 在计算机编程中,文件的顺序读写操作是最基础的操作之一,尤其在使用C++语言进行开发时,了解和掌握文件的顺序读写操作是十分重要的。在Microsoft的Visual C++(简称VC++)开发环境中,可以通过标准库中的文件操作函数来实现顺序读写功能。 ### 文件顺序读写基础 顺序读写指的是从文件的开始处逐个读取或写入数据,直到文件结束。这与随机读写不同,后者可以任意位置读取或写入数据。顺序读写操作通常用于处理日志文件、文本文件等不需要频繁随机访问的文件。 ### VC++中的文件流类 在VC++中,顺序读写操作主要使用的是C++标准库中的fstream类,包括ifstream(用于从文件中读取数据)和ofstream(用于向文件写入数据)两个类。这两个类都是从fstream类继承而来,提供了基本的文件操作功能。 ### 实现文件顺序读写操作的步骤 1. **包含必要的头文件**:要进行文件操作,首先需要包含fstream头文件。 ```cpp #include <fstream> ``` 2. **创建文件流对象**:创建ifstream或ofstream对象,用于打开文件。 ```cpp ifstream inFile("example.txt"); // 用于读操作 ofstream outFile("example.txt"); // 用于写操作 ``` 3. **打开文件**:使用文件流对象的成员函数open()来打开文件。如果不需要在创建对象时指定文件路径,也可以在对象创建后调用open()。 ```cpp inFile.open("example.txt", std::ios::in); // 以读模式打开 outFile.open("example.txt", std::ios::out); // 以写模式打开 ``` 4. **读写数据**:使用文件流对象的成员函数进行数据的读取或写入。对于读操作,可以使用 >> 运算符、get()、read()等方法;对于写操作,可以使用 << 运算符、write()等方法。 ```cpp // 读取操作示例 char c; while (inFile >> c) { // 处理读取的数据c } // 写入操作示例 const char *text = "Hello, World!"; outFile << text; ``` 5. **关闭文件**:操作完成后,应关闭文件,释放资源。 ```cpp inFile.close(); outFile.close(); ``` ### 文件顺序读写的注意事项 - 在进行文件读写之前,需要确保文件确实存在,且程序有足够的权限对文件进行读写操作。 - 使用文件流进行读写时,应注意文件流的错误状态。例如,在读取完文件后,应检查文件流是否到达文件末尾(failbit)。 - 在写入文件时,如果目标文件不存在,某些open()操作会自动创建文件。如果文件已存在,open()操作则会清空原文件内容,除非使用了追加模式(std::ios::app)。 - 对于大文件的读写,应考虑内存使用情况,避免一次性读取过多数据导致内存溢出。 - 在程序结束前,应该关闭所有打开的文件流。虽然文件流对象的析构函数会自动关闭文件,但显式调用close()是一个好习惯。 ### 常用的文件操作函数 - `open()`:打开文件。 - `close()`:关闭文件。 - `read()`:从文件读取数据到缓冲区。 - `write()`:向文件写入数据。 - `tellg()` 和 `tellp()`:分别返回当前读取位置和写入位置。 - `seekg()` 和 `seekp()`:设置文件流的位置。 ### 总结 在VC++中实现顺序读写操作,是进行文件处理和数据持久化的基础。通过使用C++的标准库中的fstream类,我们可以方便地进行文件读写操作。掌握文件顺序读写不仅可以帮助我们在实际开发中处理数据文件,还可以加深我们对C++语言和文件I/O操作的理解。需要注意的是,在进行文件操作时,合理管理和异常处理是非常重要的,这有助于确保程序的健壮性和数据的安全。
recommend-type

【大数据时代必备:Hadoop框架深度解析】:掌握核心组件,开启数据科学之旅

![【大数据时代必备:Hadoop框架深度解析】:掌握核心组件,开启数据科学之旅](https://media.licdn.com/dms/image/C4E12AQGM8ZXs7WruGA/article-cover_image-shrink_600_2000/0/1601775240690?e=2147483647&v=beta&t=9j23mUG6vOHnuI7voc6kzoWy5mGsMjHvqq5ZboqBjjo) # 摘要 Hadoop作为一个开源的分布式存储和计算框架,在大数据处理领域发挥着举足轻重的作用。本文首先对Hadoop进行了概述,并介绍了其生态系统中的核心组件。深入分
recommend-type

opencv的demo程序

### OpenCV 示例程序 #### 图像读取与显示 下面展示如何使用 Python 接口来加载并显示一张图片: ```python import cv2 # 加载图像 img = cv2.imread('path_to_image.jpg') # 创建窗口用于显示图像 cv2.namedWindow('image', cv2.WINDOW_AUTOSIZE) # 显示图像 cv2.imshow('image', img) # 等待按键事件 cv2.waitKey(0) # 销毁所有创建的窗口 cv2.destroyAllWindows() ``` 这段代码展示了最基本的图
recommend-type

NeuronTransportIGA: 使用IGA进行神经元材料传输模拟

资源摘要信息:"matlab提取文件要素代码-NeuronTransportIGA:该软件包使用等几何分析(IGA)在神经元的复杂几何形状中执行材料传输模拟" 标题中提到的"NeuronTransportIGA"是一个使用等几何分析(Isogeometric Analysis, IGA)技术的软件包,该技术在处理神经元这样复杂的几何形状时进行材料传输模拟。等几何分析是一种新兴的数值分析方法,它利用与计算机辅助设计(CAD)相同的数学模型,从而提高了在仿真中处理复杂几何结构的精确性和效率。 描述中详细介绍了NeuronTransportIGA软件包的使用流程,其中包括网格生成、控制网格文件的创建和仿真工作的执行。具体步骤包括: 1. 网格生成(Matlab):首先,需要使用Matlab代码对神经元骨架进行平滑处理,并生成用于IGA仿真的六面体控制网格。这里所指的“神经元骨架信息”通常以.swc格式存储,它是一种描述神经元三维形态的文件格式。网格生成依赖于一系列参数,这些参数定义在mesh_parameter.txt文件中。 2. 控制网格文件的创建:根据用户设定的参数,生成的控制网格文件是.vtk格式的,通常用于可视化和分析。其中,controlmesh.vtk就是最终生成的六面体控制网格文件。 在使用过程中,用户需要下载相关代码文件,并放置在meshgeneration目录中。接着,使用TreeSmooth.m代码来平滑输入的神经元骨架信息,并生成一个-smooth.swc文件。TreeSmooth.m脚本允许用户在其中设置平滑参数,影响神经元骨架的平滑程度。 接着,使用Hexmesh_main.m代码来基于平滑后的神经元骨架生成六面体网格。Hexmesh_main.m脚本同样需要用户设置网格参数,以及输入/输出路径,以完成网格的生成和分叉精修。 此外,描述中也提到了需要注意的“笔记”,虽然具体笔记内容未给出,但通常这类笔记会涉及到软件包使用中可能遇到的常见问题、优化提示或特殊设置等。 从标签信息“系统开源”可以得知,NeuronTransportIGA是一个开源软件包。开源意味着用户可以自由使用、修改和分发该软件,这对于学术研究和科学计算是非常有益的,因为它促进了研究者之间的协作和知识共享。 最后,压缩包子文件的文件名称列表为"NeuronTransportIGA-master",这表明了这是一个版本控制的源代码包,可能使用了Git版本控制系统,其中"master"通常是指默认的、稳定的代码分支。 通过上述信息,我们可以了解到NeuronTransportIGA软件包不仅仅是一个工具,它还代表了一个研究领域——即使用数值分析方法对神经元中的物质传输进行模拟。该软件包的开发和维护为神经科学、生物物理学和数值工程等多个学科的研究人员提供了宝贵的资源和便利。
recommend-type

【Linux多系统管理大揭秘】:专家级技巧助你轻松驾驭

![【Linux多系统管理大揭秘】:专家级技巧助你轻松驾驭](https://www.geima.es/images/slides/virtualizacion-sistemas-y-servidores_01.jpg) # 摘要 本文全面介绍了Linux多系统管理的关键技术和最佳实践。首先概述了多系统管理的基本概念,随后详细探讨了多系统的安装与启动流程,包括系统安装前的准备工作、各主流Linux发行版的安装方法以及启动管理器GRUB2的配置。接下来,文章深入分析了Linux多系统间文件共享与数据迁移的策略,特别是NTFS与Linux文件系统的互操作性和网络文件系统(NFS)的应用。此外,本
recommend-type

fofa和fofa viewer的区别

### Fofa与Fofa Viewer的区别 #### 功能特性对比 FoFA 是一个专注于安全研究的搜索引擎,能够帮助用户发现互联网上的各种资产信息。而 Fofa Viewer 则是一个基于 FoFA 的客户端应用,旨在简化 FoFA 的使用流程并提供更友好的用户体验[^1]。 - **搜索能力** - FoFA 提供了丰富的语法支持来精确查找特定条件下的网络资源。 - Fofa Viewer 将这些高级功能集成到了图形界面中,使得即使是初学者也能轻松执行复杂的查询操作[^2]。 - **易用性** - FoFA 主要面向有一定技术背景的安全研究人员和技术爱好者。 -