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 |
|
eem_2055
Yak Posting Veteran
69 Posts |
Posted - 2007-11-15 : 02:39:21
|
| Hi guys<I wan to know what command can I use to view the latest date of posting of interest in my database given the following tablesTable: DepositInterestFields: code1, code2, interestdatecode 1 and 2 are primary keys.Then I tried to run a query using where clause but then it happened that all interestdate are viewed.What I want is to just view the latest interestdate. |
|
|
elancaster
A very urgent SQL Yakette
1208 Posts |
Posted - 2007-11-15 : 02:53:34
|
| select max(interestdate)from depositInterestEm |
 |
|
|
eem_2055
Yak Posting Veteran
69 Posts |
Posted - 2007-11-15 : 03:15:20
|
| it's not applicable sir;sample result that I've made is:code1 |code2 |interestposteddate0001 |02 |02/07/20070001 |02 |01/06/20060001 |03 |02/05/20070001 |03 |01/16/2006it should be code1 |code2 |interestposteddate0001 |02 |02/07/20070001 |03 |02/05/2007what code can I use? |
 |
|
|
elancaster
A very urgent SQL Yakette
1208 Posts |
Posted - 2007-11-15 : 03:22:07
|
ah... so you don't want to JUST view the last interestdate  select code1,code2,max(interestdate)from depositInterestgroup by code1,code2 Em |
 |
|
|
eem_2055
Yak Posting Veteran
69 Posts |
Posted - 2007-11-15 : 06:36:23
|
| Thanks a lot! it really helps me.. |
 |
|
|
|
|
|