Answer the question
In order to leave comments, you need to log in
How to join on json column?
Needed:
Make a search for companies where users match certain search expressions. Users are connected with the company via the json property column where the object with the company_id property is stored.
I make a request like this:
DB::table('companies')
->join('users', 'users.properties.company_id', '=', 'companies.company_id')
->select(['companies.company_id', 'companies.properties', 'companies.created_at', 'companies.updated_at'])
->get();
SQLSTATE[42P01]: Undefined table: 7 ERROR: missing FROM-clause entry for table "properties"
LINE 1: ...pdated_at" from "companies" inner join "users" on "users"."p...
^ (SQL: select "companies"."company_id", "companies"."properties", "companies"."created_at", "companies"."updated_at" from "companies" inner join "users" on "users"."properties"."company_id" = "companies"."company_id")
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question