导出值形成几乎 2 个具有以下条件的双表
Export values form almost 2 twin tables with the following conditions
我想为自己做一个项目,但我不知道如何从几乎 2 个双胞胎 tables 导出值,如果库存总数量 =<5,则导出 ID,名称,数量加急table我查询的是这个
CREATE TABLE IF NOT EXISTS `Spital`.`Stoc General`
(
`ID Produs` INT,
`Denumire` VARCHAR(45) NOT NULL,
`Cantitate` INT NULL,
PRIMARY KEY (`ID Produs`)
)
ENGINE = InnoDB;
SELECT * FROM `Spital`.`Stoc General`;
INSERT INTO `spital`.`stoc general` (`ID Produs`, `Denumire`, `Cantitate`)
VALUES ('1', 'Clabax', '20');
INSERT INTO `spital`.`stoc general` (`ID Produs`, `Denumire`, `Cantitate`)
VALUES ('2', 'Betadina', '15');
INSERT INTO `spital`.`stoc general` (`ID Produs`, `Denumire`, `Cantitate`)
VALUES ('3', 'Paracetamo', '4');
INSERT INTO `spital`.`stoc general` (`ID Produs`, `Denumire`, `Cantitate`)
VALUES ('4', 'Oxigen', '3');
CREATE TABLE IF NOT EXISTS `Spital`.`Stoc URGENT`
(
`ID Produs` INT NOT NULL AUTO_INCREMENT,
`Denumire` VARCHAR(45) NOT NULL,
`Cantitate` INT NOT NULL,
`Date Delivery` DATETIME NULL,
PRIMARY KEY (`ID Produs`)
)
ENGINE = MEMORY;
使用 INSERT INTO 语句 使您能够将数据插入指定的列
INSERT INTO `spital`.`stoc urgent`
(`id produs`,
`denumire`,
`cantitate`)
SELECT `id produs`,
`denumire`,
`cantitate`
FROM `spital`.`stoc general`
where `cantitate`<5
我想为自己做一个项目,但我不知道如何从几乎 2 个双胞胎 tables 导出值,如果库存总数量 =<5,则导出 ID,名称,数量加急table我查询的是这个
CREATE TABLE IF NOT EXISTS `Spital`.`Stoc General`
(
`ID Produs` INT,
`Denumire` VARCHAR(45) NOT NULL,
`Cantitate` INT NULL,
PRIMARY KEY (`ID Produs`)
)
ENGINE = InnoDB;
SELECT * FROM `Spital`.`Stoc General`;
INSERT INTO `spital`.`stoc general` (`ID Produs`, `Denumire`, `Cantitate`)
VALUES ('1', 'Clabax', '20');
INSERT INTO `spital`.`stoc general` (`ID Produs`, `Denumire`, `Cantitate`)
VALUES ('2', 'Betadina', '15');
INSERT INTO `spital`.`stoc general` (`ID Produs`, `Denumire`, `Cantitate`)
VALUES ('3', 'Paracetamo', '4');
INSERT INTO `spital`.`stoc general` (`ID Produs`, `Denumire`, `Cantitate`)
VALUES ('4', 'Oxigen', '3');
CREATE TABLE IF NOT EXISTS `Spital`.`Stoc URGENT`
(
`ID Produs` INT NOT NULL AUTO_INCREMENT,
`Denumire` VARCHAR(45) NOT NULL,
`Cantitate` INT NOT NULL,
`Date Delivery` DATETIME NULL,
PRIMARY KEY (`ID Produs`)
)
ENGINE = MEMORY;
使用 INSERT INTO 语句 使您能够将数据插入指定的列
INSERT INTO `spital`.`stoc urgent`
(`id produs`,
`denumire`,
`cantitate`)
SELECT `id produs`,
`denumire`,
`cantitate`
FROM `spital`.`stoc general`
where `cantitate`<5