插入选择MariaDB查询

时间:2019-03-19 13:37:31

标签: mysql sql mariadb

我试图插入表A,其中需要从表B中选择其值之一。我使用了以下查询。

function grd_woocommerce_script_cleaner() {

    // Remove the generator tag
    remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );
    // Unless we're in the store, remove all the cruft!
    if ( ! is_woocommerce() && ! is_cart() && ! is_checkout() ) {
        wp_dequeue_style( 'woocommerce_frontend_styles' );
        wp_dequeue_style( 'woocommerce-general');
        wp_dequeue_style( 'woocommerce-layout' );
        wp_dequeue_style( 'woocommerce-smallscreen' );
        wp_dequeue_style( 'woocommerce_fancybox_styles' );
        wp_dequeue_style( 'woocommerce_chosen_styles' );
        wp_dequeue_style( 'woocommerce_prettyPhoto_css' );
        wp_dequeue_script( 'selectWoo' );
        wp_deregister_script( 'selectWoo' );
        wp_dequeue_script( 'wc-add-payment-method' );
        wp_dequeue_script( 'wc-lost-password' );
        wp_dequeue_script( 'wc_price_slider' );
        wp_dequeue_script( 'wc-single-product' );
        wp_dequeue_script( 'wc-add-to-cart' );
        wp_dequeue_script( 'wc-cart-fragments' );
        wp_deregister_script( 'wc-cart-fragments' );
        wp_dequeue_script( 'wc-credit-card-form' );
        wp_dequeue_script( 'wc-checkout' );
        wp_deregister_script( 'wc-checkout' );
        wp_dequeue_script( 'wc-add-to-cart-variation' );
        wp_dequeue_script( 'wc-single-product' );
        wp_dequeue_script( 'wc-cart' );
        wp_dequeue_script( 'wc-chosen' );
        wp_dequeue_script( 'woocommerce' );
        wp_deregister_script( 'woocommerce' );
        wp_dequeue_script( 'prettyPhoto' );
        wp_dequeue_script( 'prettyPhoto-init' );
        wp_dequeue_script( 'jquery-blockui' );
        wp_dequeue_script( 'jquery-placeholder' );
        wp_dequeue_script( 'jquery-payment' );
        wp_dequeue_script( 'fancybox' );
        wp_dequeue_script( 'jqueryui' );        
        wp_dequeue_script( 'cart-widget' );
        wp_deregister_script( 'cart-widget' );      
        wp_dequeue_script( 'wc-address-i18n-override' );
        wp_deregister_script( 'wc-address-i18n-override' );
    }
}
add_action( 'wp_enqueue_scripts', 'grd_woocommerce_script_cleaner', 99 );

我不知道这是怎么回事,但是面对这个错误。

  

1064-您的SQL语法有错误;检查手册   对应您的MariaDB服务器版本以获取正确的语法

1 个答案:

答案 0 :(得分:2)

"4"插入select

INSERT INTO `TableA` (`TableACol1`,`TableACol2`)
SELECT 4, `TableBcol1` FROM `TableB` WHERE FirstName="shasha"

https://dev.mysql.com/doc/refman/8.0/en/insert-select.html