Solved

Join table

Posted on 2008-06-09
8
238 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
8 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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 500 total points
ID: 21749296
please find the attached file
DateTimeStyles.txt
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now