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 |
|
joblot1976
Starting Member
10 Posts |
Posted - 2005-07-11 : 22:01:43
|
| How can i find max date and close value corresponding to that date. The following query doesn't work as A.Close is not a part of aggregate function and using group by on A.Close gives undesired results.SELECT MAX(A.Date), A.CloseFROM (tblSecurityDay A INNER JOIN tblSecurity B ON A.SecurityID = B.SecurityID)INNER JOIN CompanyDetails C ON B.SecurityCode = C.CompanyCode AND B.CompanyKey = C.CompanyKeyWHERE C.CompanyCode = 'ABC' AND C.CompanyKey = 1 Thanks |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-07-12 : 00:42:16
|
If you use aggregate function you need to group it by a Columnquote: using group by on A.Close gives undesired results.
Then post table structures, sample data and the Desired ResultMadhivananFailing to plan is Planning to fail |
 |
|
|
AndyB13
Aged Yak Warrior
583 Posts |
|
|
|
|
|