Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Select multiple column form database in Laravel

How can I run following query in Laravel?

Select column1,column2,column3 from table;

I don't want to retrieve all columns records as we do by

Select * from table;
like image 404
Nishal Gurung Avatar asked Sep 29 '15 09:09

Nishal Gurung


Video Answer


1 Answers

Use this :

DB::table('table')
    ->select(array('column1', 'column2', 'column3'))
    ->get();
like image 103
Rohit Dalal Avatar answered Oct 20 '22 18:10

Rohit Dalal