Hi, I'm trying to conduct a subquery however I'm getting the following error:
{
"code": "ER_BAD_FIELD_ERROR",
"errno": 1054,
"sqlState": "42S22",
"index": 0
}
This is the query: 'SELECT id, first_name, last_name, docs = (SELECT COUNT(id) FROM documents WHERE employee_id =
employees.id ) FROM employees'.
The column 'docs' doesn't exist in the table employees. I would like to compute this field based on the count of documents from the documents table.