I'm working on a project for a work agency in the Netherlands.
I made a java application for the workers to see what time they work at which company and which car they have to take to get there.
I want to retrieve this information from a MSSQL database into my java app into jtabels. The only problem i have is the MSSQL query to accomplish this.
These are the tables in my mssql database on a ms sql server:
tbl.Employee
Employee_ID PK
Employee_Name
Employee_House
tbl.EmployeeAss ignment
Employee_ID
Assignment_ID
tbl.Assignment
Assignment_ID PK
Company_ID
Starttime
PickupTime
tbl.Company
Company_ID PK
Company_Name
Company_Info
tbl.AssignmentC ar
Car_ID
Assignment ID
tbl.Car
Car_ID PK
Car_Number
Car_Location
Car_People
My goal for now is to select ALL from tbl.car where Employee_ID is "myID" and Assigment_ID is one of the maximum 2 IDs there are for a certain Employee.
Every Employee can work at more companies and every company has more employees. For every company there can be more cars assigned to it.
I made a java application for the workers to see what time they work at which company and which car they have to take to get there.
I want to retrieve this information from a MSSQL database into my java app into jtabels. The only problem i have is the MSSQL query to accomplish this.
These are the tables in my mssql database on a ms sql server:
tbl.Employee
Employee_ID PK
Employee_Name
Employee_House
tbl.EmployeeAss ignment
Employee_ID
Assignment_ID
tbl.Assignment
Assignment_ID PK
Company_ID
Starttime
PickupTime
tbl.Company
Company_ID PK
Company_Name
Company_Info
tbl.AssignmentC ar
Car_ID
Assignment ID
tbl.Car
Car_ID PK
Car_Number
Car_Location
Car_People
My goal for now is to select ALL from tbl.car where Employee_ID is "myID" and Assigment_ID is one of the maximum 2 IDs there are for a certain Employee.
Every Employee can work at more companies and every company has more employees. For every company there can be more cars assigned to it.
Comment