Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Join table

Posted on 2008-06-09
8
Medium Priority
?
262 Views
Last Modified: 2013-11-07
Hi,
i have 2 tables . One of the table records username and ID . another table which records the Time Attendance sheet.the structure is like below.
EmpDetails :
Emp ID    EMP Name   Date of Joining

Attendace Sheet:
EmpID Starttime   EndTime

i need to get a sql join statement to get the output like below in a grid

EMPID EmpName StartTime EndTime

Regards
Sonu
0
Comment
Question by:sonukoshy
  • 3
  • 2
6 Comments
 
LVL 39

Expert Comment

by:appari
ID: 21748623
try

Select
EMP.EMPID , EMP.EmpName , ATT.StartTime , ATT.EndTime
from EmpDetails EMP join [Attendace Sheet] ATT on
EMP.EmpID = ATT.EmpID
0
 
LVL 7

Expert Comment

by:Chandan_Gowda
ID: 21748638
select a.EmpID,a.EMPName,b.Starttime,b.EndTime from EmpDetails  a
            inner join attendence b on a.emid=b.empid
0
 

Author Comment

by:sonukoshy
ID: 21748981
That works fine for me.

How can i get the just the time from the Startime Field.

regards
Sonu
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 7

Expert Comment

by:Chandan_Gowda
ID: 21749044
select a.EmpID,a.EMPName,convert(varchar,b.Starttime,108) as Starttime,convert(varchar,b.EndTime,108) as Endtime from EmpDetails  a
            inner join attendence b on a.emid=b.empid


0
 

Author Comment

by:sonukoshy
ID: 21749087
What is this 108?
and how can i get AM & PM which is already in the database
0
 
LVL 7

Accepted Solution

by:
Chandan_Gowda earned 2000 total points
ID: 21749296
please find the attached file
DateTimeStyles.txt
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
Suggested Courses

773 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