Kupte si prémiovou propagaci a toto místo bude vaše.
Zobrazují se odpovědi 1 až 4 z 4

Jak vytvořit insert k níže uvedenému selectu?

  1. Dobrý den, můžete mi prosím poradit, jak vytvořit insert k níže uvedenému selectu? Nedaří se mi to nijak zformulovat :/

    ????Insert into ps_stock????


    Select ps_feature_value_lang.value As Physical_quantity, ps_product.reference, ps_product.id_product, ps_warehouse.id_warehouse From ps_feature_product Inner Join ps_feature_value_lang On ps_feature_product.id_feature_value = ps_feature_value_lang.id_feature_value Inner Join ps_product On ps_product.id_product = ps_feature_product.id_product Inner Join ps_feature_lang On ps_feature_product.id_feature = ps_feature_lang.id_feature Inner Join ps_warehouse On ps_warehouse.name = ps_feature_lang.name Where ps_feature_lang.name = 'PI'


    Tabulka ps_stock:
    CREATE TABLE ps_stock (
    id_stock int(11) unsigned NOT NULL AUTO_INCREMENT,
    id_warehouse int(11) unsigned NOT NULL,
    id_product int(11) unsigned NOT NULL,
    id_product_attribute int(11) unsigned NOT NULL,
    reference varchar(64) NOT NULL,
    ean13 varchar(13) DEFAULT NULL,
    isbn varchar(32) DEFAULT NULL,
    upc varchar(12) DEFAULT NULL,
    physical_quantity int(11) unsigned NOT NULL,
    usable_quantity int(11) unsigned NOT NULL,
    price_te decimal(20,6) DEFAULT '0.000000',
    PRIMARY KEY (id_stock),
    KEY id_warehouse (id_warehouse),
    KEY id_product (id_product),
    KEY id_product_attribute (id_product_attribute)
    ) ENGINE=MyISAM AUTO_INCREMENT=29 DEFAULT CHARSET=utf8

  2. Co se právě děje na Webtrhu?
  3. prestashop neznám, předpokládám, že struktury jsou z něho. Z dat, která jsi poskytl vůbec není jasné jaké datové typy jsou v selectu a to nejspíš ti dělá problém.

    Osobně bych zkusil si ze selectu vytvořit tabulku

    Kód:
    create table ps_stock_test AS 
    Select ps_feature_value_lang.value As Physical_quantity, ps_product.reference, ps_product.id_product, ps_warehouse.id_warehouse From ps_feature_product Inner Join ps_feature_value_lang On ps_feature_product.id_feature_value = ps_feature_value_lang.id_feature_value Inner Join ps_product On ps_product.id_product = ps_feature_product.id_product Inner Join ps_feature_lang On ps_feature_product.id_feature = ps_feature_lang.id_feature Inner Join ps_warehouse On ps_warehouse.name = ps_feature_lang.name Where ps_feature_lang.name = 'PI';
    a porovnat vytvořenou tabulkou s ps_stock, budou tam některé rozdíly.

    Případně poskytni chybovou hlášku, kde bude také nejspíš napsané co děláš špatně.

  4. usable_quantity má NOT NULL - buď povolte nebo nahraďte nulu v SELECTu


    insert into ps_stock (physical_quantity, reference,id_product,id_warehause ,usable_quantity)
    Select ps_feature_value_lang.value As Physical_quantity,
    ps_product.reference,
    ps_product.id_product,
    ps_warehouse.id_warehouse,
    0
    From ps_feature_product
    Inner Join ps_feature_value_lang On ps_feature_product.id_feature_value = ps_feature_value_lang.id_feature_value
    Inner Join ps_product On ps_product.id_product = ps_feature_product.id_product
    Inner Join ps_feature_lang On ps_feature_product.id_feature = ps_feature_lang.id_feature
    Inner Join ps_warehouse On ps_warehouse.name = ps_feature_lang.name Where ps_feature_lang.name = 'PI'

  5. Děkuji za radu, pomohla :)

    Někdo by řekl, že je to školácká chyba, jenže já školák nejsem - jen pouhopouhý samouk.


    Ještě jednou děkuji, ušetřil jste mi hodně času.


    Citace Původně odeslal takatom Zobrazit příspěvek
    usable_quantity má NOT NULL - buď povolte nebo nahraďte nulu v SELECTu


    insert into ps_stock (physical_quantity, reference,id_product,id_warehause ,usable_quantity)
    Select ps_feature_value_lang.value As Physical_quantity,
    ps_product.reference,
    ps_product.id_product,
    ps_warehouse.id_warehouse,
    0
    From ps_feature_product
    Inner Join ps_feature_value_lang On ps_feature_product.id_feature_value = ps_feature_value_lang.id_feature_value
    Inner Join ps_product On ps_product.id_product = ps_feature_product.id_product
    Inner Join ps_feature_lang On ps_feature_product.id_feature = ps_feature_lang.id_feature
    Inner Join ps_warehouse On ps_warehouse.name = ps_feature_lang.name Where ps_feature_lang.name = 'PI'

Hostujeme u Server powered by TELE3