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 |
|
jayram11
Yak Posting Veteran
97 Posts |
Posted - 2010-12-08 : 11:05:06
|
| my table is LOChere is a sample of the tableID YEAR NUMBER2 2003 005102 2004 005102 2005 005102 2006 005102 2007 005102 2008 005102 2009 005102 2010 101022 2011 10102i have IDs from 1 to 100. i want to retrieve the records where the Number changes from one year to another thanks |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2010-12-08 : 11:15:49
|
| select idfrom locgroup by idhaving count(distinct number) <> 1==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2010-12-08 : 11:17:19
|
| or maybeselect *from loc l1join loc l2on l1.id = l2.idand l1.year = ld.year-1where l1.number <> l2.numberthat will give the actual changes==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
jayram11
Yak Posting Veteran
97 Posts |
Posted - 2010-12-08 : 12:58:33
|
| Thanks |
 |
|
|
|
|
|