[Logo]
Forums Register Login
Sql Select statement from 3 tables with join
Hi,

how i can select from 3 tables (task, status, employee):

Task fields:
TASK_ID (PK)
TASK_NAME
DESCRIPTION
STATUS_CODE (FK for status table)
START_DATE
END_DATE
TASK_TYPE_CODE (FK)
PRIORITY_CODE(FK)
EMPLOYEE_ID (FK for employee table)


Status fields:
STATUS_CODE (PK)
STATUS_NAME


Employee fields:
EMPLOYEE_ID (PK)
EMPLOYEE_NAME



I want to select task_id, task_name and end_date"from-to" (any date from the calendar) to (any end date) from task table, status_ name from status table and employee_name from employee table

Thank you in advance.

Start from joining 2 tables, TASK and STATUS.
Fetch TASK_ID, TASK_NAME, END_DATE, STATUS_NAME from these 2 tables using join.
Then go for the 3rd table.
Have you tried it directly against the database, using whatever gui is applicable for the db in question?

That's what I always do if I'm unsure of some SQL I've written.
You'll get faster answers that way.
No, i did not
now i'm writing the method for searching in the DAO class, i will try that
Thank you
Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards



All times above are in ranch (not your local) time.
The current ranch time is
Dec 12, 2017 09:10:23.