I'm a novice SQL user, in need of some help. My situation is this...
I have two tables, one is a users table where naturally each user has a unique id (emp_id). The second table contains records that are owned by one specific user, and there is a field named "emp_id" which contains the corresponding "emp_id" from the users table.
So, what I need to do is list all the records in the second table based on a user specified sort order, and then print out the corresponding first and last name from the user table.
Now I could just do a query for all the records in the second table output all the records in a loop, the run another query that looks at the "emp_id" and finds the match in the users table. However, that seems incredibly kludgy, there must be a way to combine these into one smart query.
Any assistance would be greatly appreciated. Thank you in advance!
I have two tables, one is a users table where naturally each user has a unique id (emp_id). The second table contains records that are owned by one specific user, and there is a field named "emp_id" which contains the corresponding "emp_id" from the users table.
So, what I need to do is list all the records in the second table based on a user specified sort order, and then print out the corresponding first and last name from the user table.
Now I could just do a query for all the records in the second table output all the records in a loop, the run another query that looks at the "emp_id" and finds the match in the users table. However, that seems incredibly kludgy, there must be a way to combine these into one smart query.
Any assistance would be greatly appreciated. Thank you in advance!