Click here to Skip to main content
15,664,272 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This has me perplexed and doesn't help that I'm having to use phpMyAdmin.

INSERT	INTO aqua_clients
VALUES	(SELECT meta_value FROM _YYV_frmt_form_entry_meta WHERE meta_key = 'name-4')

Error is:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT `meta_value` FROM _YYV_frmt_form_entry_meta WHERE `meta_key` = 'name-4')' at line 3

What I have tried:

Googling and rewriting, but am not getting any progress. The main table has the values in one column (Meta_Value), and the field name sits in Meta_key.

I'm trying to create a After Insert that places the values in their corresponding columns as soon as they are submitted via a Wordpress form.
Updated 12-Jul-20 9:47am

1 solution

When you are using a SELECT to populate the values, you "skip" the VALUES syntax
MySQL :: MySQL 8.0 Reference Manual :: INSERT ... SELECT Statement[^]
INSERT INTO aqua_clients (parent_firstname)
SELECT  meta_value
FROM    _YYV_frmt_form_entry_meta
WHERE   meta_key = 'name-4'
Share this answer
Maciej Los 13-Jul-20 5:05am    
MadMyche 14-Jul-20 21:17pm    
thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900