my $tr_id_rs = $schema->resultset("TestRunStatus")->search( { "DATE(test_run_id.start_date)" => { ">=" => $start_date, "<=" => $end_date, }, "test_run_status_type_id.name" => $status_type, }, { select => "test_run_id.id", join => ["test_run_id", "test_run_status_type_id"], group_by => "test_run_id.id", order_by => "test_run_id.id",} );