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.
| Author |
Topic |
|
peace
Constraint Violating Yak Guru
420 Posts |
Posted - 2012-02-07 : 23:51:45
|
| I would like to count all into 1 column which is TotalCountID Status Subject1 New CheckIn2 New CheckIn3 New Enquiry4 Close CheckOutMy statement is not working.select ID, Status, Subject, count(*) as totalCountID Status Subject TotalCount1 New CheckIn 12 New CheckIn 13 New Enquiry 14 Close CheckOut 1It suppose to be like this:ID Status Subject TotalCount1 New CheckIn 23 New Enquiry 14 Close CheckOut 1Is it because the ID is different? How can I count including publishing the ID?For my report, when I click totalcount 2, it will eleborate to more details. Is it possible? Is something like a link. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
peace
Constraint Violating Yak Guru
420 Posts |
Posted - 2012-02-08 : 01:12:05
|
| But the ID show random ID |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2012-02-08 : 01:20:19
|
quote: Originally posted by peace But the ID show random ID
It is not random but the smallest ( min ) IDCan you define for same status & Subject, which ID do you want ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
peace
Constraint Violating Yak Guru
420 Posts |
Posted - 2012-02-08 : 01:31:38
|
| Im trying to apply for my report.When I click totalCount 2, it will give the output as below:ID Status Subject TotalCount1 New CheckIn 12 New CheckIn 1 |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2012-02-08 : 02:08:52
|
[code]select ID, Status, Subject, TotalCount = 1from yourTablewhere Status = 'New'and Subject = 'Checkin'[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|
|
|