Get results from two different tables using a complex query or procedure. Read the details please.
I have two tables. 1. employees(id, name) 2. documents(id, employee_id, file_path, document_type[PASSPORT, DL, PAN_CARD]) I want to list these details like this ------------------------------------------------- | Employee | Passport | DL | PAN_CARD| | ABC | 1 | 1 | 0 | | AFG | 0 | 1 | 1 | | XYZ | 2 | 1 | 1 | ------------------------------------------------- *Here integer value denotes the number of scanned documents saved with a employee_id in 'documents' table. *Sometimes we have to scan a document from both side or multiple pages. So multiple documents with same 'document_type' and 'employee_id' can exists(Example 'XYZ' with 2 passport document).