-2
I have to do an SQL search in several tables.
I need to relate the two through a common "id" but I do not know how because I do not have declared Primary Keys or Foreign Keys.
Follows code snippet:
SELECT a.iban, TO_CHAR(date_, 'month ,yyyy-dd') AS "Opening date", o.client_id AS "Client NR.", op.status
FROM operation o JOIN open_operation op ON o.id_op = op.id
JOIN account a ON o.account_id = a.id
JOIN client c ON o.client_id = c.id
Here is information that needs to be included in the previous query:
SELECT y.name
FROM agency y JOIN account a ON y.id = a.agency_id