I got database table like this:
**job_id**
5
5
5
6
6
7
8
8
I want to write query, which could select only unique id's. By saying unique I mean select only these values once:
5, 6, 7, 8
Thanks in advance!
I got database table like this:
**job_id**
5
5
5
6
6
7
8
8
I want to write query, which could select only unique id's. By saying unique I mean select only these values once:
5, 6, 7, 8
Thanks in advance!
Copyright © 2021 Jogjafile Inc.
How about:
Eloquent:
php artisan make:model jobs(I assume you have done this already) This will create a model in /your_project/app/Job.phpNow you can use Eloquent (here in a route, to see some output):
Route::get('/jobs', function () { $jobs = \App\Job::groupBy('job_id')->get(); return $jobs->lists('job_id'); });will return something like:
[0,1,3,4]instead of[0, 1, 1, 1, 3, 4, 4, 4].