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 |
|
sqllover
Constraint Violating Yak Guru
338 Posts |
Posted - 2008-04-15 : 05:50:30
|
| hi, my table data:Sensor_Serial_No date_time Attribute_Flag-----------------------------------------------------2 2008-03-03 01:00:00 52 2008-03-03 06:00:00 5my result should be like this Sensor_Serial_No no of times occured Attribute_Flag lastoccurence2 2 5 2008-03-03 06:00:00please give me query for this please |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-04-15 : 05:58:16
|
| [code]SELECT Sensor_Serial_No,COUNT(*) AS [no of times occured],Attribute_Flag,MAX(date_time) AS lastoccurenceFROM YourTableGROUP BY Sensor_Serial_No,Attribute_Flag[/code] |
 |
|
|
sqllover
Constraint Violating Yak Guru
338 Posts |
Posted - 2008-04-15 : 06:02:26
|
| thank you friend |
 |
|
|
|
|
|