0

谁能让我知道我在这里做错了什么.....这是我的查询并在尝试在 sqlite 数据库管理器中运行查询时出现语法错误“near SELECT”

INSERT INTO proposal_products(proposal_id,date_created,date_modified,quantity,installation_position,notes,proposal_location_id,parent_id,prompt,cost_price,sale_price,service_price,labour_hours,maint_hours,comm_hours,adj_cost_price,adj_sale_price,adj_service_price,adj_labour_hours,adj_maint_hours,adj_comm_hours,is_adjusted,adj_unit_price,discipline_products_id)VALUES('1000000','27-02-2013','27-02-2013',3,'dfdf','dsdsd',6,58,'hghfg',21,22,22,48,45,45,0,0,0,0,0,0,1,0,SELECT id FROM discipline_products WHERE product_id = SELECT id FROM products WHERE c4w_code = 'STDD')

这是错误的快照 在此处输入图像描述

4

2 回答 2

0
INSERT INTO proposal_products 
(
    proposal_id,
    date_created,
    date_modified,
    quantity,
    installation_position,
    notes,
    proposal_location_id,
    parent_id,
    prompt,
    cost_price,
    sale_price,
    service_price,
    labour_hours,
    maint_hours,
    comm_hours,
    adj_cost_price,
    adj_sale_price,
    adj_service_price,
    adj_labour_hours,
    adj_maint_hours,
    adj_comm_hours,
    is_adjusted,
    adj_unit_price,
    discipline_products_id
)
VALUES( '1000000',
        '27-02-2013',
        '27-02-2013',
        3,
        'dfdf',
        'dsdsd',
        6,
        58,
        'hghfg',
        21,
        22,
        22,
        48,
        45,
        45,
        0,
        0,
        0,
        0,
        0,
        0,
        1,
        0,
       ( SELECT id FROM discipline_products WHERE product_id = (SELECT id 
                                                                 FROM products
                                                                WHERE c4w_code = 'STDD')
        ))
于 2013-07-02T08:42:47.760 回答
0

试试这个方法:

INSERT INTO proposal_products(proposal_id,date_created,date_modified,quantity,installation_position,notes,proposal_location_id,parent_id,prompt,cost_price,sale_price,service_price,labour_hours,maint_hours,comm_hours,adj_cost_price,adj_sale_price,adj_service_price,adj_labour_hours,adj_maint_hours,adj_comm_hours,is_adjusted,adj_unit_price,discipline_products_id)
SELECT '1000000','27-02-2013','27-02-2013',3,'dfdf','dsdsd',6,58,'hghfg',21,22,22,48,45,45,0,0,0,0,0,0,1,0, id 
FROM discipline_products 
WHERE product_id = (SELECT id FROM products WHERE c4w_code = 'STDD')
于 2013-07-02T07:32:23.683 回答