i have MYSQL database where a table have a field that contains multiple values in each cell. where these values are a foreign key of another table.
inspection_date:
- siteID (primary key)
- employeeID(foreign key)
- inspectionDate
where the emplyee field will have multiple values be cause more than one employee had done the inspection.
employee
- employeeID(primary key)
- employeeName
can anyone help me to use select query
mysql :
$query_site_location =$wpdb->get_results("select DISTINCT
l.siteID,
l.locationName,
n.inspectionDate,
s.employeeID
from site_location l
LEFT
JOIN inspection_info n
on l.siteID = n.siteID
LEFT
JOIN employee s
on n.employeeID = s.employeeID");
the result must be in the field of employee (6-7) for the first row