update datawarehouse.cube_contract_detail_info cube left join business.contract co on co.id = cube.pt_contract_id set cube.pt_house_space_id=co.house_space_id where cube.pt_build_date = '2023-02-19';
时间: 2023-03-11 14:25:35 浏览: 198
更新 datawarehouse.cube_contract_detail_info cube 左联接 business.contract co on co.id = cube.pt_contract_id 设置 cube.pt_house_space_id=co.house_space_id where cube.pt_build_date = 2023-02-19;
相关问题
import.meta.env.VITE_WAREHOUSE_CONTEXT_PATH
在Vue3中,使用`import.meta.env.VITE_WAREHOUSE_CONTEXT_PATH`来获取环境变量VITE_WAREHOUSE_CONTEXT_PATH。这是因为在Vue3中,`process.env`不再直接生效,而是使用`import.meta.env`来获取环境变量。这个环境变量可以在vite.config.ts文件中配置,例如在`vite.config.ts`中可以使用`loadEnv(mode, process.cwd()).VITE_WAREHOUSE_CONTEXT_PATH`来获取VITE_WAREHOUSE_CONTEXT_PATH的值。
create trigger update_purchase_warehouse after insert on purchase for each row Begin set @count; select count(*) into count from warehouse where com_no=NEW.com_no; IF (@count>0) THEN update warehouse set com_num=com_num+NEW.com_gnum where com_no=NEW.com_no; ELSE insert into warehouse(com_no,com_name,com_overdue,com_num) values(NEW.com_no,NEW.com_name,NEW.com_overdue,NEW.com_gnum); END if; END;
根据你提供的 SQL 语句,我注意到以下问题:
1. 在 `Set @count;` 这行代码中,变量 @count 没有被初始化。应该将其设置为0或其他初始值。
2. 在 `select count(*) into count from warehouse where com_no=NEW.com_no;` 这行代码中,应该将 `into count` 改为 `into @count`,以便将查询结果赋值给 @count 变量。
3. 在 `END if; END;` 这行代码中,应该将 `END if;` 改为 `END IF;`,因为 IF 语句应该用大写。
下面是修正后的 SQL 语句:
```
CREATE TRIGGER update_purchase_warehouse
AFTER INSERT ON purchase
FOR EACH ROW
BEGIN
SET @count = 0;
SELECT COUNT(*) INTO @count FROM warehouse WHERE com_no = NEW.com_no;
IF (@count > 0) THEN
UPDATE warehouse SET com_num = com_num + NEW.com_gnum WHERE com_no = NEW.com_no;
ELSE
INSERT INTO warehouse (com_no, com_name, com_overdue, com_num)
VALUES (NEW.com_no, NEW.com_name, NEW.com_overdue, NEW.com_gnum);
END IF;
END;
```
希望这次修改对你有帮助!
阅读全文