Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Appear once for Count

Author  Topic 

peace
Constraint Violating Yak Guru

420 Posts

Posted - 2012-03-21 : 23:07:39
Hi, How can I do this?
I want the total people stay in house 100A to appear only once.

House Name Total
100A Jacob 2
100A Jane 2

Appear only once

House Name Total
100A Jacob 2
100A Jane

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-03-21 : 23:17:56
looks like a presentation issue. Do this in your front end appplication


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

peace
Constraint Violating Yak Guru

420 Posts

Posted - 2012-03-21 : 23:23:51
Can't understand
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-03-21 : 23:34:56
i mean do this where you are displaying the data. What you want is just not to show the data when the House is repeating. This can be easily done at your client side where the data is displayed.



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

peace
Constraint Violating Yak Guru

420 Posts

Posted - 2012-03-21 : 23:39:00
i would like to display it only once in my report.
can be done in the query itself?
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-03-21 : 23:41:34
yes. it can be done in query. But can't your report handle this at all ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

peace
Constraint Violating Yak Guru

420 Posts

Posted - 2012-03-21 : 23:47:57
Is better if can be handle in query itself :D
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-03-21 : 23:59:46
most people here think otherwise

well, if you really want to do it in SQL side

select House, Name, Total = case when rn = 1 then Total end
from
(
select House, Name, Total, rn = row_number() over (partition by House order by Name)
from yourtable
) d
order by House, Name



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

peace
Constraint Violating Yak Guru

420 Posts

Posted - 2012-03-22 : 00:43:08
Any idea how can I apply in reports? Im using SSRS(Microsoft Visual Studio 2008)
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-03-22 : 00:49:13
You are using SSRS !

Should have said so earlier. You don't need to do it in T-SQL. SSRS can handle that. It is just i am not familiar with SSRS.

You should post your question in Reporting Services
http://www.sqlteam.com/forums/forum.asp?FORUM_ID=35 or
http://www.sqlteam.com/forums/forum.asp?FORUM_ID=45


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

peace
Constraint Violating Yak Guru

420 Posts

Posted - 2012-03-22 : 00:54:41
Owh okay..
Go to Top of Page
   

- Advertisement -