Временная таблица sql TEMPORARY

При ошибке ERROR 1093 (HY000) at line 25: Table 'comments' is specified twice, both as a target for 'INSERT' and as a separate source for data CREATE TEMPORARY TABLE temp_comments AS SELECT id FROM comments WHERE created_at = '2015-03-09 02:22:57' LIMIT 1; DROP TEMPORARY TABLE temp_comments; ".(!empty($item['parent_date']) ? "CREATE TEMPORARY TABLE temp_comments AS SELECT id FROM comments WHERE created_at = '".$item['parent_date']."' LIMIT 1;" : "")." INSERT IGNORE INTO `comments` ( `group_type`, `group_id`, `model_type`, `model_id`, `group_ip`, ".(!empty($item['parent_date']) ? "`parent_id`, " : "")." `rating`, `score`, `body`, `created_at` ) VALUES ( 'App\Models\User', '1', 'App\Models\Article', (SELECT `id` FROM `articles` WHERE `url` = '".$item['article_url']."' LIMIT 1), '".$item['ip']."', ".(!empty($item['parent_date']) ? "(SELECT id FROM temp_comments), " : "")." '".$item['rating']."', '0', '".$item['text']."', '".$item['date']."' ); ".(!empty($item['parent_date']) ? "DROP TEMPORARY TABLE temp_comments;" : "")."