Reputation: 2963
How would I produce a query that displays user_id 1 whos a member of the club and subjects that are either football or tennis.
id|user_id|member|subject
1 | 1 |Yes |football
2 | 1 |Yes |NULL
3 | 2 |Yes |football
4 | 3 |Yes |tennis
5 | 1 |No |tennis
6 | 1 |Yes |tennis
So basically I would like the resulting rows to be:
id|user_id|member|subject
1 | 1 |Yes |football
6 | 1 |Yes |tennis
Upvotes: 0
Views: 367
Reputation: 641
DB::table('users')->
where('user_id','=','1')->
where('subject','!=','Null')->
distinct()->
get();
Upvotes: 1