SQL SERVER 2005 Self Joins output
Posted
by user301751
on Stack Overflow
See other posts from Stack Overflow
or by user301751
Published on 2010-03-25T14:14:35Z
Indexed on
2010/03/25
14:23 UTC
Read the original article
Hit count: 174
HI I am looking for some help I just can't seem to get my head how self joins work. I have this sql code
select Persno'Name',convert(char(20), A_Date , 13)'Logins',acode
from atrail as LOGIN
where acode = 'LOGIN' OR acode = 'LOGOUT'
order by a_date desc
Which produces a list of User names and when the have logged in and out. What I am trying to acheive is to get anther column with the LOGOUT date next to the date they logged in date so that it is easyer to see when they logged in and out.
Thanks
Andy
© Stack Overflow or respective owner