• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Sql Select statement from 3 tables with join

 
Ranch Hand
Posts: 66
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Ranch Hand
Posts: 624
9
BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
wadha alketbi
Ranch Hand
Posts: 66
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, i did not
now i'm writing the method for searching in the DAO class, i will try that
Thank you
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic