Click here to Skip to main content
11,935,031 members (51,350 online)
Rate this:
Please Sign up or sign in to vote.
My database structure of attendance table is like this
ID   EmpName        Date             Status
1    Raj           1/12/2012             P
2    Rahul         1/12/2012             P
3    Raj           2/12/2012             P
4    Rahul         2/12/2012             P
5    Raj           3/12/2012             A
6    Rahul         3/12/2012             P
7    Raj           4/12/2012             A
8    Rahul         4/12/2012             P

And i want to customize the output in following format
EmpName  1  2  3  4
Raj      P  P  A  A
Rahul    P  P  P  P

So please help me on above issue
Posted 2-Jan-13 1:33am
Edited 2-Jan-13 1:56am
@AmitGajjar 2-Jan-13 6:37am
Pivot may work for you.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

PIVOT is an option. You have two approaches listed here:[^]. Look for the accepted answer. And you will get a playground also to test it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web04 | 2.8.151126.1 | Last Updated 2 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100