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 |
CyberSquealer
Starting Member
11 Posts |
Posted - 2011-10-07 : 10:18:51
|
I have a table structure similar toCol1 Col2123ABC 13:53:32123ABC 13:55:25123ABC 13:59:43789XYZ 14:14:23789XYZ 14:14:23789XYZ 14:14:23If I were toSelect Distinct Col1 from table1I get all rows returned because the values are different in Col2How can I only return the first instance of the value(123) in column 1 skipping the same values until I get to the next different value (789XYZ)Many thanks |
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2011-10-07 : 10:23:56
|
select col1, min(col2) from mytable group by col1 |
|
|
CyberSquealer
Starting Member
11 Posts |
Posted - 2011-10-07 : 10:48:42
|
A slightly different way of looking at problem!Many thanks |
|
|
|
|
|