Click here to Skip to main content
15,903,822 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello programmers, got a question here supposed I have a table with this columns
CourseCategory               Course                  Date
I.T                          data management         2011
BSCS                         programming             2011
BSCS                         programming 2           2011
I.T                          hardware management     2010
ACT                          technical               2011    
BSCS                         Writing                 2010

My question is how can I get the latest date based on my table above, in this case 2011? Cause what i want is that when I create another term for next year the current term datas must be applied when I create it. Any tutorial regarding this?
Posted

1 solution

Use the following query :

SQL
select Max(Date) from tablename where course='Writing'
 
Share this answer
 
Comments
janwel 12-Oct-11 1:46am    
ill try sir
janwel 12-Oct-11 1:50am    
Sir how about if I use it in where clause for example ^^Select * from [table] where Date=Max[Date]^^ is this correct sir?
Vikas_Shukla_89 12-Oct-11 1:56am    
hey janwel, try this
select * from dbo.Table where DATE = (select max(DATE) from dbo.Table)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900