Last active
October 5, 2018 02:29
-
-
Save sola-msr/f59a0902d08e659e0d804c9b13b3a3fc to your computer and use it in GitHub Desktop.
【Laravel】LaravelでDISTINCTを使用する、かつ実行されているSQLを確認してみる ref: https://qiita.com/sola-msr/items/ff857e51680404c4a439
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self::where('user_id', $user_id)->distinct()->select('team_id')->get(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var_dump(self::where('user_id', $user_id)->distinct()->select('team_id')->toSql()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select distinct `team_id` from `tables` where `user_id` = ? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment