Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

bireland's avatar

Nubee trying to do a select distinct query...

I am trying to get the following query to work in laravel. I am doing a great job of showing the 'Woops, it looks like you are doing something wrong' error but not accomplishing it... Any help would be great:

SELECT distinct CONCAT(users.first_name, ' ',users.last_name, ' ', TIME_FORMAT(emp_trained_courses.start_time, "%h:%p"), ' ', DATE_FORMAT(emp_trained_courses.course_date,"%b %D %Y")) AS sbox FROM emp_trained_courses join users on users.id = emp_trained_courses.instructor_id WHERE emp_trained_courses.course_date = CURRENT_DATE() ORDER BY emp_trained_courses.course_date desc, emp_trained_courses.start_time asc

0 likes
3 replies
bireland's avatar

the query I am trying doesn't give a result....

$sbox = DB::table('users') ->join('emp_trained_courses','emp_trained_courses.instructor_id','=','users.id') ->distinct() ->get()->pluck(['users.first_name','users.last_name','emp_trained_cources.course_date','emp_trained_courses.start_time']);

bireland's avatar

I get nothing, just a blank page. If I run any other of my quires in the select box it works?

Please or to participate in this conversation.