亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何在查詢中添加不等于的地方

如何在查詢中添加不等于的地方

PHP
RISEBY 2022-01-24 09:48:21
我正在嘗試將條件添加為active is not qual to 1,但我無法弄清楚它是如何在我的查詢中正常工作的。這是我的查詢$career_solutions_data = DB::select("SELECTcareer_solutions.id,role_users.role_id,career_solutions.user_id,career_solutions.subject,career_solutions.date,career_solutions.public,career_solutions.views,career_solutions.optional,career_solutions.on_offer,career_solutions.active,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 certificationFROM career_solutionsINNER JOIN categoriesON categories.id = career_solutions.topic_category_idINNER JOIN career_solutions_formatON career_solutions_format.id = career_solutions.topic_format_idINNER JOIN career_solutions_certificationON career_solutions_certification.id = career_solutions.topic_certification_idINNER JOIN career_solutions_categoriesON career_solutions_categories.id = career_solutions.topic_subcategory_idINNER JOIN usersON users.id = career_solutions.user_idLEFT JOIN role_users on role_users.role_id = users.idINNER JOIN privacy_settingsON privacy_settings.user_id = users.idWHERE users.deleted_at IS NULLAND ((privacy_settings.career_solutions = 0 AND public = 1 )OR (users.id IN (SELECT contacts.contact_idFROM contactsWHERE contacts.user_id = $id)))OR users.id = $idORDER BY date desc limit 5000");$role = User::with('role')->where ('id', '=', $id)->first();                }            }這是我試圖添加的內容:WHERE `career_solutions.active` <> `1`orWHERE `active` <> `1`orWHERE `active` != `1`但沒有工作。所以,我不需要用 . 顯示帖子active = 1。我還有另外 3 個查詢,不同的是,我用過這個 : ->where("active","!=",1);,但在這里我不能使用它。
查看完整描述

1 回答

?
catspeake

TA貢獻1111條經驗 獲得超0個贊

問題是周圍的反引號1: 這指示 MySQL 搜索1

嘗試 WHERE career_solutions.active <> 1



查看完整回答
反對 回復 2022-01-24
  • 1 回答
  • 0 關注
  • 148 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號