August 21, 2009 at 6:56 am
Hi all,
I need help on a query for reporting purpose. I want to get all the columns from table, in that one column contains repeated values.The sample data is as following
LOGINNAMESHIFTIDLOGINDATE TIMELOGOFFDATE TIMEISLATE LOGINHOURS WORKED
DDNMNT8/4/2009 9:418/4/2009 18:51YES9:11:15
DDNMNT8/5/2009 9:378/5/2009 18:42YES9:05:37
DDNMNT8/7/2009 9:338/7/2009 18:43YES9:11:15
DDNMNT8/8/2009 9:268/8/2009 18:31YES9:05:37
Now what i need is want to display the repeated column values only once for that column and remaing values should me empty.Looks like as below.
LOGINNAMESHIFTIDLOGINDATE TIMELOGOFFDATE TIMEISLATE LOGINHOURS WORKED
DDNMNT8/4/2009 9:418/4/2009 18:51YES9:11:15
MNT8/5/2009 9:378/5/2009 18:42YES9:05:37
MNT8/7/2009 9:338/7/2009 18:43YES9:11:15
MNT8/8/2009 9:268/8/2009 18:31YES9:05:37
MNT8/14/2009 9:288/14/2009 18:31YES9:05:37
MNT8/15/2009 9:408/15/2009 18:45YES9:05:37
CSS8/18/2009 9:288/18/2009 18:33YES9:05:37
CSS8/20/2009 9:468/20/2009 18:51YES9:05:37
CSS8/21/2009 9:33YES
PPPCSS8/4/2009 9:418/4/2009 18:51YES9:11:15
MNT8/5/2009 9:378/5/2009 18:42YES9:05:37
MNT8/7/2009 9:338/7/2009 18:43YES9:11:15
MNT8/8/2009 9:268/8/2009 18:31YES9:05:37
MNT8/14/2009 9:288/14/2009 18:31YES9:05:37
MNT8/15/2009 9:408/15/2009 18:45YES9:05:37
MNT8/18/2009 9:288/18/2009 18:33YES9:05:37
8/20/2009 9:468/20/2009 18:51YES9:05:37
The help would be very helpful to me.
Thanks,
August 21, 2009 at 1:22 pm
Your sample data do not really match your verbal description.
First set of data:
You're describing repeated data in one column.
But your sample contains duplicate values in 4 columns (LOGINNAME, SHIFTID, ISLATE LOGIN, HOURS WORKED).
Second set of data:
Requirement: "...to display the repeated column values only once ..."
But the data you're showing have nothing to do with the sample data you've been talking about before.
In order to be able to help you you need to provide us with consistent information so we are able to help you.
Please follow the link in my signature on how to provide sample data and make sure your expected result is based on the sample data.
August 21, 2009 at 11:18 pm
My requirement is for first column values only. No problem if other columns having duplicate data.
Thank You.
August 22, 2009 at 2:24 am
May I kindly ask you to reread my previous post with focus on my last two statements?
Regarding your reply:
There is no way to come up with login names like MNT or CSS based on your sample data.
There is no business rule on which row has to be selected. Why not
DDN MNT 8/7/2009 9:33 8/7/2009 18:43 YES 9:11:15 instead of
DDN MNT 8/4/2009 9:41 8/4/2009 18:51 YES 9:11:15 ??
You need to help us help you.
With proper sample data and requirement description your issue would have been resolved since several hours...
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply