PIVOT OR CROSSTABS? I DONT KNOW.
hi everyone,
im very puzzled with this data how to arrange in the way like this.
emp_code am_time_in am_time_out pm_time_in pm_time_out
the rules is:
1. from 6:30am until 1:30pm.
this will fall into "am_time_in" and "am_time_out".
question: what if you found more than 2 rows between 6:30am to 1:30pm?
figure: 630am, 742am, 844am and 1254noon
answer: just get only the first and last row. so that the the 630am will fall in "am_time_in" column
and 1254noon will be at "am_time_out" column
PLEASE HELP:
from the sample raw data below, how can sql statement will find only first and lastrow between 6:30 - 1:30..some are
2 entries, some are 3 entries and some are 4 or 5.
and after i found those two rows, the first and the last, respectively, how can i aline it in same row.
im sorry if my illustrations is not so clear or my goal is not stated clearly here. i am willing to answer some sort of question to solve my problem.
thank you in advance.
my email address is : liberateddreams@yahoo.com
Here is the raw data in a table separated in each column
empcode day month year time
| 27 | 25 | 1 | 2007 | 1657 |
| 27 | 25 | 1 | 2007 | 1657 |
| 27 | 25 | 1 | 2007 | 1657 |
| 27 | 25 | 1 | 2007 | 1658 |
| 27 | 25 | 1 | 2007 | 1847 |
| 27 | 25 | 1 | 2007 | 1847 |
| 27 | 25 | 1 | 2007 | 1929 |
| 27 | 27 | 1 | 2007 | 739 |
| 27 | 27 | 1 | 2007 | 740 |
| 27 | 27 | 1 | 2007 | 741 |
| 27 | 27 | 1 | 2007 | 755 |
| 27 | 27 | 1 | 2007 | 1300 |
| 27 | 27 | 1 | 2007 | 1302 |
| 27 | 27 | 1 | 2007 | 1303 |
| 27 | 27 | 1 | 2007 | 1618 |
| 35 | 25 | 1 | 2007 | 1909 |
| 35 | 25 | 1 | 2007 | 1929 |
| 35 | 27 | 1 | 2007 | 726 |
| 35 | 27 | 1 | 2007 | 1302 |
| 43 | 25 | 1 | 2007 | 1850 |
| 43 | 25 | 1 | 2007 | 1850 |
| 43 | 27 | 1 | 2007 | 720 |
| 43 | 27 | 1 | 2007 | 1559 |
| 91 | 25 | 1 | 2007 | 1649 |
| 91 | 25 | 1 | 2007 | 1649 |
| 91 | 25 | 1 | 2007 | 1659 |
| 91 | 25 | 1 | 2007 | 1830 |
| 91 | 27 | 1 | 2007 | 732 |

