因此,我尝试在查询中添加新行,但不幸的是我遇到了此错误:
SQLSTATE [42000]:语法错误或访问冲突:1064您有一个 您的SQL语法错误;检查与您的手册相对应的手册 MariaDB服务器版本可在'FROM附近使用正确的语法 职业解决方案
我要添加的内容:
career_solutions_certification as certification,
INNER JOIN certification
ON career_solutions_certification.id = career_solutions.certification
$career_solution->topic_certification_id = $request['topic_certification_id'];$career_solution->save();
这是我的代码
$career_solutions_data = DB::select("
SELECT
career_solutions.id,
career_solutions.user_id,
career_solutions.subject,
career_solutions.date,
career_solutions.public,
career_solutions.views,
career_solutions.optional,
career_solutions.on_offer,
users.username,
users.profile_picture,
categories.category,
categories.category_url,
categories.color,
career_solutions_categories.category as sub_category,
career_solutions_format.category as event_format,
career_solutions_certification.category as certification,
FROM career_solutions
INNER JOIN categories
ON categories.id = career_solutions.topic_category_id
INNER JOIN career_solutions_format
ON career_solutions_format.id = career_solutions.topic_format_id
INNER JOIN certification
ON career_solutions_certification.id = career_solutions.certification
INNER JOIN career_solutions_categories
ON career_solutions_categories.id = career_solutions.topic_subcategory_id
INNER JOIN users
ON users.id = career_solutions.user_id
INNER JOIN privacy_settings
ON privacy_settings.user_id = users.id
WHERE users.deleted_at IS NULL
AND (
(privacy_settings.career_solutions = 0 AND public = 1 )
OR (users.id IN (
SELECT contacts.contact_id
FROM contacts
WHERE contacts.user_id = $id
)
)
)
OR users.id = $id
ORDER BY date desc limit 5000
");
我的表格是career_solutions_certification
/列id
和category
。
答案 0 :(得分:2)
career_solutions_certification.category as certification
可能没有-
答案 1 :(得分:0)
选择列后还有一个逗号
Wrong : career_solutions_certification.category as certification**,**
Correct : career_solutions_certification.category as certification