ENV:
Laravel 5.7.28
Database mysql
CentOS 7.2
I have 3 table like as below, I need join this 3 table and merge columns
(customer.first_name,customer.last_name,customer.address,job.name,job.address,job.date
)
to set ‘like’ query.
For example,
After coulms merge customer.first_name,customer.last_name,customer.address,job.name,job.address,job.date
customer.first_name + customer.last_name + customer.address + job.name + job.address +job.date
is
‘TOMSMITHCecilia ChapmanABC.LtdIris Watson2019-01-10’, so
when $text = 'MS';
set 'like' '%'.$text.'%' will return below result
customer.first_name = TOM
customer.last_name = SMITH
customer.address = Cecilia Chapman
job.name = ABC.Ltd
job.address = Iris Watson
job.date = 2019-01-10
- id table (relation belongs To table customer and job)
- id
- customer_id
- job_id
- customer table
- id
- first_name
- last_name
- address
- job id
- id
- name
- address
- job_date
2
Answers
See this
If you have multiple where condition then you may use where function with orWhere like this: