Hello,

If I have a table like this where i have the year and the month, how can a get something like 2008 3 after a select? - I mean the maximum month for the maximum year?

Thank you.

year       month
2006	     1
2007	     1
2006	     2
2007	     2
2006	     3
2007	     3
2008	     3
2006	     4
2007	     4
2006	     5
2007	     5
2006	     6
2007	     6
2006	     7
2008	     3
2007	     7
2006	     8
2007	     8
2006	     9
2007	     9

As you give the information in the table
you can find it by:-

select * from Test as t1
where 0=(select count(*) from Test as t2
where t1.Year<t2.Year)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.