Solved

Join Tables in SQL

Posted on 2013-01-13
3
245 Views
Last Modified: 2013-01-15
Hello I have the following query which is giving me the data from the people not working on Today.

SELECT *
FROM q2employee_work_schedule
WHERE working = 'N' AND date1 = CAST(FLOOR(CAST(getdate() as FLOAT)) as DATETIME)

 but is giving me an employee Code "emp_code" which is fine but I need a name, there is another table called dbo.q2employees, how can I join these two tables to get the preferred name "preferred_name"  and surname

Thanks
0
Comment
Question by:jhonc66
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 38773395
SELECT q2employee_work_schedule.* ,q2employees.*
FROM q2employee_work_schedule
Inner join q2employees on q2employee_work_schedule.emp_code =q2employees.emp_code
WHERE working = 'N' AND date1 = CAST(FLOOR(CAST(getdate() as FLOAT)) as DATETIME)
0
 
LVL 39

Accepted Solution

by:
Pratima Pharande earned 500 total points
ID: 38773396
SELECT q2employee_work_schedule.* ,q2employees.preferred_name,q2employees.surname
FROM q2employee_work_schedule
Inner join q2employees on q2employee_work_schedule.emp_code =q2employees.emp_code
WHERE working = 'N' AND date1 = CAST(FLOOR(CAST(getdate() as FLOAT)) as DATETIME)
0
 

Author Closing Comment

by:jhonc66
ID: 38780845
Thanks a lot
0

Featured Post

Comparison of Amazon Drive, Google Drive, OneDrive

What is Best for Backup: Amazon Drive, Google Drive or MS OneDrive? In this free whitepaper we look at their performance, pricing, and platform availability to help you decide which cloud drive is right for your situation. Download and read the results of our testing for free!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question