Okay so I am starting to play around with the JOIN command and here is what I have:
I am working with 2 tables at the moment. Table 1 = employee and Table 2 = c2z_emp_timecard
<%
Sql_select = " SELECT employee.first_name, employee.last_name, employee.filenumber, employee.paygroup, c2z_emp_timecard.date " & _
" FROM employee " & _
" INNER JOIN c2z_emp_timecard " & _
" ON employee.filenumber=c2z_emp_timecard.filenumber " & _
" ORDER BY employee.last_name "
Set rs = dataconn.execute(sql_select)
If not rs.eof Then
Do while not rs.eof
response.Write("<Br><Br>"&Rs("date") ' should this be Rs("c2z_emp_timecard.date") ??
rs.movenext
loop
End IF
rs.close
%>
So my question is, is it possible to add a WHERE clause into the JOIN statement Like;
Sql_select = " SELECT employee.first_name, employee.last_name, employee.filenumber, employee.paygroup, c2z_emp_timecard.date " & _
" FROM employee " & _
" WHERE employee.supervisorname='John Doe' " & _
" INNER JOIN c2z_emp_timecard " & _
" ON employee.filenumber=c2z_emp_timecard.filenumber " & _
" ORDER BY employee.last_name "
If this is not possible I guess I can do an if statement after the results to check if supervisorname ='john doe' but it just seems like a lot of extra records being pulled that I don't need.
Thank you!
By the way, I haven't tested the above join statement so if it looks off let me know. Thanks!