By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,251 Members | 2,727 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,251 IT Pros & Developers. It's quick & easy.

Help please with SQL server Query

P: 1
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.EmployeeAssignment
Employee_ID
Assignment_ID

tbl.Assignment
Assignment_ID PK
Company_ID
Starttime
PickupTime

tbl.Company
Company_ID PK
Company_Name
Company_Info

tbl.AssignmentCar
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.
May 28 '10 #1
Share this Question
Share on Google+
1 Reply


P: 3
Not clear with question. Please elaborate it.
May 30 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.