I can't get the mysql syntax correct.
I would like to insert into a table 2 pieces of data, post_id and meta_value from another table on the same database and todays date, CURDATE()) .
INSERT into wp_top_voted
(post_id, number_votes, todays_date)
The following:
SELECT `post_id`
FROM `wp_postmeta` WHERE `meta_key` = 'votes' ORDER BY `meta_value` DESC
LIMIT 10
SELECT `meta_value`
FROM `wp_postmeta` WHERE `meta_key` = 'votes' ORDER BY `meta_value` DESC
LIMIT 10
CURDATE())
How do I combine the above into one statment? I tried
INSERT into wp_top_voted
(`post_id`, `number_votes`, `todays_date`)
values (SELECT `post_id`
FROM `wp_postmeta` WHERE `meta_key` = 'votes' ORDER BY `meta_value` DESC
LIMIT 10, SELECT `meta_value`
FROM `wp_postmeta` WHERE `meta_key` = 'votes' ORDER BY `meta_value` DESC
LIMIT 10, CURDATE())
but I'm getting errors.
JOINthe source tables