June 21st, 2012, 03:58 PM
PL SQL help
Anyone that could confirm if this is possible would be great,
I have a table with the following columns
I want to return any results where any employee id that has 2 different timezoneid's on the same date. I would actually like, if its possibe, to select these etnries to display on one row per employee per day. So for example
EMPLOYEEID - PUNCHDTM - TIMEZONEID - PUNCHDTM - TIMEZONEID
12345 - 6/20/2012 5:00 am - 123 - 6/20/2012 10:00am - 456
To me who is newer with SQL this sounds like i would be 'joining' the table to itself so i've searched for that but not found what i need.
Thank you in advance for any help
June 21st, 2012, 05:42 PM
This should get you started:
Note that this won't work correctly if an employee has more than 2 timezones.
from a_table e1
join a_table e2
on e1.employeeid = e2.employeeid
and e1.timezoneid <> e2.timezoneid
June 22nd, 2012, 12:51 PM
well that worked with a slight tweak so i thank you but idiot here found a view that already stores the punches linked together with appropriate timezone.
June 22nd, 2012, 01:23 PM
But you learned something!
Originally Posted by sandsawks