LoginSignup
0
0

More than 1 year has passed since last update.

Laravelのクエリビルダで使われる比較演算子について

Posted at

Laravelのクエリビルダで下記のようなコードを見つけた。

->where('team_id', '<>', $team_id)

あまり見慣れなかった比較演算子だったので再度調べた所、

「 a <> b 」  は  「 a と b は等しくない 」

という意味らしい。

つまり、下記は「team_idと$team_idが等しくないもの」という条件指定となる。

->where('team_id', '<>', $team_id)

「<、<=」などは条件分岐で馴染みがあるが、
SQL独自の比較演算子なのか「<>、a <=> b」などは知らなかったので今後のために覚えておく。

参考記事はこちら↓

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0