473,394 Members | 1,658 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Pls Help In Login And Logout

Can somebody help me with my problem in sql... I have an attendancelog table where i have 3 columns Date, EmpID, IN/OUT, Date and Time. I would like to transfer this data in another column where it has Date, EmpID, IN Date and Time Column, and OUT Date and Time Column. I'm just new in sql i dont know how to implement it.

I am using sql server 2000. I have already a table with data in the first table. I need to transfer the data in the second table

For example:

1st Table Contain Logs
Column
Date EmpID IN/OUT Date and Time
10/11/2007 20 IN 10/11/2007 11:00 AM
10/11/2007 1 IN 10/11/2007 11:10 AM
10/11/2007 1 OUT 10/11/2007 10:00 PM
10/12/2007 20 OUT 10/12/2007 6:00 AM

I would like to transfer the IN and OUT of the the same EmpID to a single row

2nd Table
Date EmpID DateTime IN DateTime OUT
10/11/2007 20 10/11/2007 11:00 AM 10/12/2007 6:00 AM
10/11/2007 1 10/11/2007 11:10 AM 10/11/2007 10:00 PM
Nov 5 '08 #1
3 1448
ck9663
2,878 Expert 2GB
Can somebody help me with my problem in sql... I have an attendancelog table where i have 3 columns Date, EmpID, IN/OUT, Date and Time. I would like to transfer this data in another column where it has Date, EmpID, IN Date and Time Column, and OUT Date and Time Column. I'm just new in sql i dont know how to implement it.

I am using sql server 2000. I have already a table with data in the first table. I need to transfer the data in the second table

For example:

1st Table Contain Logs
Column
Date EmpID IN/OUT Date and Time
10/11/2007 20 IN 10/11/2007 11:00 AM
10/11/2007 1 IN 10/11/2007 11:10 AM
10/11/2007 1 OUT 10/11/2007 10:00 PM
10/12/2007 20 OUT 10/12/2007 6:00 AM

I would like to transfer the IN and OUT of the the same EmpID to a single row

2nd Table
Date EmpID DateTime IN DateTime OUT
10/11/2007 20 10/11/2007 11:00 AM 10/12/2007 6:00 AM
10/11/2007 1 10/11/2007 11:10 AM 10/11/2007 10:00 PM
try:

Expand|Select|Wrap|Line Numbers
  1. select in.date, in.empid, in.datetimeIN, out.datetimeout
  2. from
  3. (select date, empid, datetime as datetimein from FirstTable where [in/out] ='IN') full outer join 
  4. (select date, empid, datetime as datetimeout from FirstTable where [in/out] ='OUT') out on in.empid = out.empid
  5.  
  6.  
Happy Coding!

-- CK
Nov 5 '08 #2
It wont to work...

The following are the fullname of the tables:
wherein the [LogTransType] = [LogTransDesc]
0 IN
1 OUT

From this data
[LogDate] [LogEmpID] [LogTransType] [LogTransDesc] [LogDateTime]
10/11/2007 20 0 IN 10/11/2007 11:00 AM
10/11/2007 10 0 IN 10/11/2007 11:10 AM
10/11/2007 10 1 OUT 10/11/2007 10:00 PM
10/12/2007 20 1 OUT 10/12/2007 6:00 AM

To this data
[LogDate] [LogEmpID] [LogIN] [LogOUT]
10/11/2007 20 10/11/2007 11:00 AM 10/12/2007 6:00
10/11/2007 10 10/11/2007 11:10 AM 10/11/2007 10:00


Please help again...
Nov 7 '08 #3
Thanks... for the code. The code really works its just it was missing an in alias before the FULL OUTER JOIN.

Thanks for helping
Nov 10 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: konsu | last post by:
hello, i need to implement a secure web site in php and mysql but i have just started looking at php a few days ago, and i would appreciate any advice from the experts. the site, as i said,...
0
by: Peter Brown | last post by:
Hello! I am stepping through a text book that sets up different websites. The one I am testing is user registration. I set up the scripts and this is what I observe: Login (verifying...
1
by: MichaelR | last post by:
I have an asp.net application using forms authentication. 1. It has a simple login page (login.aspx) that uses FormsAuthentication.RedirectFromLoginPage(. . . ). 2. My application has a logout...
2
by: ad | last post by:
I use Login control's Authenticate event to authenticate use. I find that different users can use the same ID to login in the same time. How can I restrict that the some ID can only login once in...
0
by: ShailShin | last post by:
Hi All, Developing an VB App for Login and logout tracking. In App Form there are two buttons login and logout. When user click on login the loginName, LoginTime and LoginDate get stored in...
2
by: Dan | last post by:
Hi, I use the logon control for logging into the application. When logging and checking the option "remember me next time" and then closing the browser without to press any logout button which...
2
by: André | last post by:
Hi, When clicking on "remember me" when logging, the user asks for not to have to log in next time he visits the site. Now, on one side, i read it is recommended to logout properly (clicking...
1
by: Kandiman | last post by:
Hiya, i made a asp page, and one of my divs (as a include) is as below. the problem is if the main page is resubmitted, i get logged out again?... heres the code.. i think its on the value=true...
1
by: Adrock952 | last post by:
I have a link on my site which obviously says "Login" where users log in. I would like that link to be changed to "Logout" when the user has successfully logged in and the session has been created...
10
by: DavidPr | last post by:
When I logout as one user and log in under a different user, it opens with the last user's information. User 1 - Unsername: Davey Jones User 2 - Unsername: David Smith I log out from Davey...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.