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 |
|
imughal
Posting Yak Master
192 Posts |
Posted - 2004-06-08 : 08:00:43
|
| hi, i have to tables clients and fileinfo. client contains clientid and file info contain data uploaded by client with respect to date.i have to clist clientid and last data uploaded date by client.result should be like thatclient id : last date11 01-jun-200414 01-mar-200415 01-dec-200316 01-jan-2004i have tried query.select caclientsloginid, (select max(creationdate) from fileinfo where caclientsloginid=caclientsloginid) from caclientslogin order by caclientsloginidbut fail to catch clientid whihc is selected first and put it to where clause.any help will be appreciated. |
|
|
joldham
Wiseass Yak Posting Master
300 Posts |
Posted - 2004-06-08 : 08:19:22
|
| Not sure I understand 100% what your question is, but I will give it a shot anyways.SELECT a.caclientsloginid, max(b.creationdate) lastdateFROM caclientslogin aINNER JOIN fileinfo bON a.caclientsloginid = b.caclientsloginidGROUP BY a.caclientsloginidorder by a.caclientsloginidLet me know if this isn't what you are looking for.Jeremy W. Oldham |
 |
|
|
imughal
Posting Yak Master
192 Posts |
Posted - 2004-06-09 : 05:40:59
|
| thanks now my requirements has little bit added. now my result should be like that.Client last month jan feb mar apr ..... Dec11 01-jun-2004 y14 01-mar-2004 y15 01-dec-2003 N 16 01-jan-2004 ynow i have to check on each month if data is available on that month against clientid then i have to mark that month field.can you pls tell me how to do that. |
 |
|
|
|
|
|