Solved

Join table

Posted on 2008-06-09
8
249 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
[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
  • 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
Industry Leaders: 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!

 
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

Technology Partners: 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

Suggested Solutions

Title # Comments Views Activity
import as existing maven project 3 41
Requesting help with creating an SQL query to select similar records 4 21
SQL Server syntax 11 41
SP result not being displayed 5 44
Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand columnThat will then direct you to their download page.From that page s…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

726 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