Click here to Skip to main content
13,091,369 members (54,423 online)
Rate this:
Please Sign up or sign in to vote.
I have two tables Employee Details and EmpAttendance.

Employee Details has EmployeeID ,EmployeeNAME, EMailID columns.
EmpAttendance has c_Date , Eid, Intime, Outtime,Count columns.

i have a form in windows app, when we type employeeID and press Submit Button, I need to display

S.NO c_Date EmployeeID EmployeeNAME EMailID Intime Outime Count TotalWorkingHours

where TotalWorkingHours is the difference between outtime and intime.

suggest me how to do this.
Posted 20-Feb-13 22:58pm
Updated 20-Feb-13 23:33pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You need to start with database basics.
Do a join between the two tables and subrtact the datetimes values for intime and outtime to get totalworking hours.

Simple Database Application - Part 1[^] should help you get started.

For datetime calculations on query, try[^].
Vardhan Desai 21-Feb-13 5:12am
There is no Foreign Key in EmpAttendance or Matching values, so no join is possible.

--Regards Vardhan Desai
Bala Selvanayagam 21-Feb-13 5:30am
Do we need a foreign key actually defined in order to do a join ?
Vardhan Desai 21-Feb-13 7:02am
Not necessary but a matching column values with same datatype should be there for Join condition.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Make a Foreign Key in Table EmpAttendance with respect to EmployeeID; then do Join with matching this columns.

--Regards Vardhan Desai

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.170813.1 | Last Updated 21 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100