Quite new to SQL and no idea how to do this. Have two tables:
Table 1 is employees: (Column Name), (Data Type), (Allow Nulls)
ID, int, no nulls
Empname, varchar(50), no nulls
team, varchar(10), nulls
branch, varchar(5), no nulls
position, varchar(2), nulls
Table 2 is RAWH: (Column Name), (Data Type), (Allow Nulls)
ID, int, no nulls
EmpPIN, varchar(6), nulls
Empname, varchar(50), no nulls
dateRequested, datetime, nulls
startdate, datetime, nulls
stopdate, datetime, nulls
TypeHrs, varchar(50), nulls
NoOfHours, decimal(4,2), nulls
projects, varchar(200), nulls
justification, varchar(200), nulls
RCbeginDate, datetime, nulls
RCendDate, datetime, nulls
RCLvSlip, varchar(3), nulls
reqDecision, varchar(8), nulls
denialReason, varchar(300), nulls
From the RAWH table I have the Empname generated into a text field. From this field containing the Empname I want to get from the employee table the following information which I will place into hidden input fields:
team and branch.
Now armed with team and branch I need to create another query to get a name from the employees' table from position where the teams are the same and the position shows tl (position has three entries - 1 is tl, 2 is bc and 3 is NULL).
I also need to get the Empname from employees where position is bc and the braches are equal.
I hope this makes sense.
Any help is greatly appreciated.
Thank you - JS
Table 1 is employees: (Column Name), (Data Type), (Allow Nulls)
ID, int, no nulls
Empname, varchar(50), no nulls
team, varchar(10), nulls
branch, varchar(5), no nulls
position, varchar(2), nulls
Table 2 is RAWH: (Column Name), (Data Type), (Allow Nulls)
ID, int, no nulls
EmpPIN, varchar(6), nulls
Empname, varchar(50), no nulls
dateRequested, datetime, nulls
startdate, datetime, nulls
stopdate, datetime, nulls
TypeHrs, varchar(50), nulls
NoOfHours, decimal(4,2), nulls
projects, varchar(200), nulls
justification, varchar(200), nulls
RCbeginDate, datetime, nulls
RCendDate, datetime, nulls
RCLvSlip, varchar(3), nulls
reqDecision, varchar(8), nulls
denialReason, varchar(300), nulls
From the RAWH table I have the Empname generated into a text field. From this field containing the Empname I want to get from the employee table the following information which I will place into hidden input fields:
team and branch.
Now armed with team and branch I need to create another query to get a name from the employees' table from position where the teams are the same and the position shows tl (position has three entries - 1 is tl, 2 is bc and 3 is NULL).
I also need to get the Empname from employees where position is bc and the braches are equal.
I hope this makes sense.
Any help is greatly appreciated.
Thank you - JS