How do I convert rows to columns in aAccess using Ms-access query(select statment)

5 pts.
Tags:
Microsoft Access function
Microsoft Access queries
Microsoft Access tables
Hello all, please I want help with the following issue:
I have the following table named "CHECKINOUT" in ms ACCESS
USERID      NAME        CHICKTIME
1          K1        5:45:11 AM
1          K1        3:45:12 AM

1          K1        6:45:11 AM

1          K1        3:35:13 AM

1          K1        6:35:14 AM

1          K1        3:35:15 AM

1          K1        6:25:16 AM

2          K2        3:25:17 AM

2          K2        5:25:17 AM

2          K2        3:15:18 AM

2          K2        3:25:19 AM

2          K2        4:45:10 AM

2          K2        2:45:11 AM

3          K3        7:25:13 AM

3          K3        6:15:14 AM

3          K3        5:25:15 AM

3          K3        3:35:12 AM

3          K3        5:55:12 AM

4          K4        5:05:22 AM

4          K4        4:15:32 AM

4          K4        3:55:42 AM

4          K4        1:35:52 AM

4          K4        2:43:42 AM

.           .         .

.           .         .

.           .         .

.           .         .
I want to convert the previous table to the get the  following result using MS-access query:
USERID      NAME    CHICKIN1    CHECKOUT1    CHICKIN2  CHECKOUT2     CHECKIN3  CHICKOUT 3  CHECKIN 4  CHECKOUT4 CHECKIN5
1          K1     5:45:11 AM  3:45:12 AM  3:45:12 AM  3:35:15 AM  4:45:10 AM
2          K2     10:45:12 AM 11:45:12 AM 1:45:12 PM  2:45:12 AM  3:45:12 PM
3          K3     9:45:12 AM  10:45:12 AM  2:45:12 APM 1:45:12 AM 3:45:12 AM
4          K4     8:45:12 AM  4:45:12 PM   4:45:12 AM  5:45:12 AM  5:45:12 AM
 The `CHECKIN`, `CHECKOUT`, `COLUMN_NIMBER` depend on the data in `CHECKTIME` for every user.


Software/Hardware used:
Software

Answer Wiki

Thanks. We'll let you know when a new response is added.

I’m not sure but I think this link might be what you are looking for.

Let me know if this helps! Good luck.

Robert

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • carlosdl
    Hi Ahejazi. We could assume, but it would be better if you provide more details and clarify the question. Your original data shows 3 columns only (userid,name,chicktime), but in your desired results you have CHICKIN's and CHECKOUT's. How do you separate chicktimes into chickins and checkouts ? What is the logic behind those results ? Also, at the end of the question you say "The `CHECKIN`, `CHECKOUT`, `COLUMN_NIMBER` depend on the data in `CHECKTIME` for every user". But we don't see any COLUMN_NIMBER in your original data, nor in your desired results. Also, how exactly do them depend on the data in 'CHECKTIME' ?
    70,220 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following