Solved

Join table

Posted on 2008-06-09
8
239 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SQL Query Syntax Error 9 48
Updating ms sql with special characters 8 41
Oracle 10g - insert string with special characters 8 41
oracle 11g 23 50
In database programming, custom sort order seems to be necessary quite often, at least in my experience and time here at EE. Within the realm of custom sorting is the sorting of numbers and text independently (i.e., treating the numbers as number…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

895 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

15 Experts available now in Live!

Get 1:1 Help Now