Q:

SQL Statement with 3 References and Date Statement

i am actually messing around with MS SQL 2014 and trying to create a statement for our Sharepoint Server.
We have a Timecard Apllication where we see which one of our Workers is working and who isnt.
I have 3 Tables
[easyjob].[dbo].[Address] where i have IDAddress as Join Column.
This Table Containts Name of the Worker.
[easyjob].[dbo].[TimeCardUser] where i have IDAdress and IDTimeCardUser
This Table Contains the User for the Timecard Application.
[easyjob].[dbo].[TimeCardWorkTime] where i have IDTImeCardUser
This Table Contains the working time. For that i have already a working SQL Statement that gives me the Workers that are in House:
`SELECT [IdTimeCardWorkTime]
      ,[IdTimeCardUser]
      ,[IdTimeCardWorkTimeType]
      ,[WorkStart]
      ,[WorkEnd]
      ,[Duration]
      ,[IdUserCreated]
      ,[IdUserUpdated]
      ,[CreationTime]
      ,[UpdateTime]
      ,[Description]
  FROM [easyjob].[dbo].[TimeCardWorkTime] WHERE [WorkEnd] is NULL AND [WorkStart] BETWEEN 
   CAST(GETDATE() AS DATE) AND DATEADD(DAY, 1, CAST(GETDATE() AS DATE))`

Which gives
IdTimeCardWorkTime IdTimeCardUser  IdTimeCardWorkTimeType  WorkStart   WorkEnd Duration    IdUserCreated   IdUserUpdated   CreationTime    UpdateTime  Description
3655    22  1   2015-12-03 07:55:00.000 NULL    NULL    55  55  2015-12-03 07:55:00.000 2015-12-03 07:56:00.033 NULL
Now i just have to get the Names to the Output.
Then this will be shown at our sharepoint intranet.
Can somebody help me.
I will appreciate it.
Regards
Sascha

A:

You Have Try Something Like Below
 SELECT T.[IdTimeCardWorkTime]
      , T.[IdTimeCardUser]
      , A.[NAME]
      , T.[IdTimeCardWorkTimeType]
      , T.[WorkStart]
      , T.[WorkEnd]
      , T.[Duration]
      , T.[IdUserCreated]
      , T.[IdUserUpdated]
      , T.[CreationTime]
      , T.[UpdateTime]
      , T.[Description]
  FROM [easyjob].[dbo].[TimeCardWorkTime] T
  INNER JOIN [easyjob].[dbo].[TimeCardUser] W
    ON (T. IDTimeCardUser  = W.IDTImeCardUser)
  INNER JOIN [easyjob].[dbo].[Address] A
    ON (W. IDAdress  = A.IDAdress)
  WHERE T.[WorkEnd] IS NULL 
    AND T.[WorkStart] BETWEEN CAST(GETDATE() AS DATE) AND DATEADD(DAY, 1, CAST(GETDATE() AS DATE))

Hope This Helps

