Hi Experts,
I have the following query.
$Query = "INSERT INTO completed_orders SELECT * FROM temp_order_details where client = '$_SESSION[UserID]'";
The table structure is quite large and the above is a favorable way to do the insert. THe only problem is that there is a primary key column called id. I can see that there will be a primary key conflict as more orders are created.
Is there any way to write the query but leave the 'id' column out??
Or do I have to write it as follows:
$Query = "INSERT INTO completed_orders (ordernumber, client, itemcode, colour, carcass_height, carcass_length, carcass_length_right, carcass_depth, carcass_depth_right, door1_height, door2_height, door3_height, door4_height, door1_width, door2_width, door3_width, door4_width, qty_adj_shelves, adj_shelf_depth, qty_fixed_shelves, fixed_shelf_depth, fixed_shelf_height, number_of_drawers, draw0, draw1, draw2, draw3, draw4, draw5, draw6, blind_panel, rail_type, void_single_left, void_right, door_hinge_drilling, qty, comments, plant_on_height, plant_on_width, plant_on_qty, stamp, shelfoption, cost, edging, ubo,whitecost,colourcost,j
asonwhitec
ost,jasonc
olourcost)
SELECT
ordernumber, client, itemcode, colour, carcass_height, carcass_length, carcass_length_right, carcass_depth, carcass_depth_right, door1_height, door2_height, door3_height, door4_height, door1_width, door2_width, door3_width, door4_width, qty_adj_shelves, adj_shelf_depth, qty_fixed_shelves, fixed_shelf_depth, fixed_shelf_height, number_of_drawers, draw0, draw1, draw2, draw3, draw4, draw5, draw6, blind_panel, rail_type, void_single_left, void_right, door_hinge_drilling, qty, comments, plant_on_height, plant_on_width, plant_on_qty, stamp, shelfoption, cost, edging, ubo,whitecost,colourcost,j
asonwhitec
ost,jasonc
olourcost
FROM
temp_order_details
where client = '$_SESSION[UserID]' order by id asc";
Thanks experts.
Start Free Trial