I’ve tried following the syntax suggested here, but it doesn’t work for my query.
Here’s what I currently have:
INSERT INTO dot (entrant_id, year, entry_code, title, retail_category, campaign_type, client_company, client_city, client_state, field_date_active, height, width, depth, weight, oversize_fee, volt_110, attach_to_gridwall, hang_from_ceiling, table_or_countertop, misc_setup, created_date, modified_date, co_entrant)
VALUES (288, 2011, 1234, 'RG Total Defense BW mixed Floorstand', '32', 'C', 'Henkel', 'Scottsdale', 'AZ', '2011-01-15', 60, 26, 15, 29, 0, '0', '0', '0', '0', '', NOW(), NOW(), '')
However, I need the value of entry_code to be selected from the same table – I can do it as an individual query:
MAX(entry_code) FROM dot WHERE year = 2011
but can’t seem to integrate that with the insert statement. Is this possible? Or will a subquery like that only work if it’s selecting from a different table?
1 Answer