mercredi 7 novembre 2018

laravel query builder whereIn get duplicate data

I am currently trying to get the candidate ids of a list of candidate names i have, for this i am currenly using the below query,

            foreach ($candidateName as $index => $row) {
                $candidateIDS = DB::table('candidates')
                    ->select('id', 'account_name')
                    ->whereIn('account_name', $candidateName)
                    ->get();
            }

the above query looks for the candidate names i send through the candidateName array and outputs the data as expected.

My question is how to get duplicate data through the query. as the candidateName array have duplicate name records, and i need the query output to have the duplicate candidate id and name as with the candidateName array.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire