You don’t have a ON
for your LEFT JOIN
, I guess the WHERE
statement you use has to be the ON
statement.
You should use this query instead:
$querystr = "
DELETE FROM $wpdb->posts
LEFT JOIN $wpdb->postmeta ON $wpdb->postmeta.post_id = $wpdb->posts.ID
WHERE $wpdb->postmeta.meta_key = 'randomID'
AND $wpdb->postmeta.meta_value="$randomID"";
Reference here: http://dev.mysql.com/doc/refman/5.0/en/join.html