Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not getting all results #179

Open
asalkey opened this issue Dec 8, 2014 · 1 comment
Open

Not getting all results #179

asalkey opened this issue Dec 8, 2014 · 1 comment
Labels

Comments

@asalkey
Copy link

asalkey commented Dec 8, 2014

I am not able to get all the results only the last one here is what I have in the controller

            DB::table('vendor')
            ->join('contractor_category_vendor', 'contractor_category_vendor.vendor_id', '=', 'vendor.id')
            ->join('contractor_category', function($join)
                {
                    $join->on('contractor_category.id', '=', 'contractor_category_vendor.contractor_category_id');
                })
            ->select('contractor_category.contractor_type');

The vendor is associated to many categories and it's only pulling the last one not all of them.

@MarkVaughn
Copy link
Contributor

If you run ->toSql() you get following query

select `contractor_category`.`contractor_type` from `vendor` inner join `contractor_category_vendor` on `contractor_category_vendor`.`vendor_id` = `vendor`.`id` inner join `contractor_category` on `contractor_category`.`id` = `contractor_category_vendor`.`contractor_category_id`

Does running that in phpmyadmin show the results you expect?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants