Advertisement:

Author Topic: MySql Trigger Help  (Read 1791 times)

Offline Plus

  • Jr. Member
  • **
  • Posts: 123
  • Gender: Male
    • turkishairforce.org on Facebook
    • Oy Turkiyem
MySql Trigger Help
« on: August 29, 2018, 05:57:29 AM »
I Have 3 Tables:

1) CREATE TABLE `UrunPaketDetay`(
    `UrunPaketDetay` int NOT NULL AUTO_INCREMENT,
    `UrunPaketNo` int NULL,
    `Tarih` date NULL,
    `Barkod` varchar(14) NOT NULL,
    `Urun` varchar(50) NULL,
    `SunumSekli` varchar(50) NULL,
    `IslemeSekli` varchar(50) NULL,
    `PaketlemeSekli` varchar(50) NULL,
    `Kalibre` varchar(50) NULL,
    `Kilo` double NULL,
    `GlazeOran` varchar(50) NULL,
    `Uretici` varchar(190) NULL,
    `PaletKod` varchar(50) NULL,
    PRIMARY KEY (`UrunPaketDetay`)
)CHARACTER SET utf8;

2) CREATE TABLE `CkisEks`(
    `CikId` int NOT NULL AUTO_INCREMENT,
    `Tarih` date NULL,
    `Musteri` varchar(190) NULL,
    `TeslimatYer` varchar(50) NULL,
    `CikisSaati` time NULL,
    `AracPlakasi` varchar(18) NULL,
    `AracTel` varchar(16) NULL,
    `KonteynirNo` varchar(50) NULL,
    `PaletKod` varchar(12) NULL,
    `Kilo` double NULL,
    PRIMARY KEY (`CikId`)
)CHARACTER SET utf8;

3) CREATE TABLE `Ckis_Detay`(
    `CD_Id` int NOT NULL AUTO_INCREMENT,
    `CikId` int NULL,
    `Barkod` varchar(50) NULL,
    `Urun` varchar(50) NULL,
    `Kalibre` varchar(50) NULL,
    `Kilo` double NULL,
    `Uretici` varchar(50) NULL,
    `Musteri` varchar(190) NULL,
    `PaletKod` varchar(50) NULL,
    `Tarih` date NULL,
    PRIMARY KEY (`CD_Id`)
)CHARACTER SET utf8;
My Question:

I fill up my first table. After on 2nd table i call PaletKod row. PaletKod row autofill Kilo Row on 2nd table from 1st Table.

But i need when i fill PaletKod to my 2nd table how can i select Paletkod from first table and fill my 3rd table values (Uretici, Urun, Kilo, Kalibre ) ?

I need trigger code could u help ?