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 |
|
maryfsan
Starting Member
1 Post |
Posted - 2012-04-11 : 21:52:53
|
| Hi. This seems like it should be simple. I am trying to find the latest year for each company. Sample data:Company Fiscal YearAAA 2008AAA 2009AAA 2010BBB 2008BBB 2009CCC 2011CCC 2010Desired output:AAA 2010BBB 2009CCC 2011I am running SQL Server 2008 R2. I've tried various combinations of things but it's clear I don't under the logic of SELECT. Thanks. |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2012-04-11 : 22:05:25
|
[code]SELECT Company, MAX(FixcalYear)FROM YourTableGROUP BY Company[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-04-12 : 00:25:55
|
| hope you dont want to return any other fields from table if it exists------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
vinu.vijayan
Posting Yak Master
227 Posts |
Posted - 2012-04-12 : 06:08:03
|
Yup!!...was as simple as that. N 28° 33' 11.93148"E 77° 14' 33.66384" |
 |
|
|
|
|
|