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 |
|
azharrahi
Starting Member
44 Posts |
Posted - 2007-04-30 : 06:46:50
|
| Hope you all will be fine. I have Two Tables Insurant(IID, PolicyNo, PolicyTypeID) and PolicyType(PolicyTypeID, PolicyTypeName, PolicyTypeCode)Now Insurant contains the ID of PolicyTypeI want that Max(IID) must be retrieved for each of PolicyCode of PolicyType. e.g. there are 8 policyTypes and I want that against each code The max(IID) must be retrieved from Insurant Table. Van any body tell me the query and solve my problem. ThanksAzhar RahiSoftware EngineerExperts Desk Pvt Ltd,Lahore Pakistan |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-04-30 : 06:49:32
|
| select t2.polictypecode, max(t1.iid)from policytype as t2inner join insurant as t1 on t1.policytypeid = t2.policytypeidgroup by t2.polictypecodePeter LarssonHelsingborg, Sweden |
 |
|
|
azharrahi
Starting Member
44 Posts |
Posted - 2007-04-30 : 06:49:32
|
| Sorry I left some useful info as well ... the PolicyNo is created using PolicyCode of Policytype. I want to retrieve Max(IID) from Insurant where there is a PolicyNo concatenated with the specific PolicyCode of PolicyType.Azhar RahiSoftware EngineerExperts Desk Pvt Ltd,Lahore Pakistan |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-04-30 : 06:54:33
|
| It would be more clear if you could post some sample data and expected output.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
azharrahi
Starting Member
44 Posts |
Posted - 2007-04-30 : 07:12:08
|
| I have got the solution of my own so feel no need to query any more. By the way thanks for replyAzhar RahiSoftware EngineerExperts Desk Pvt Ltd,Lahore Pakistan |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-04-30 : 07:13:06
|
| It would be the proper thing to share the solution for other to benefit from this.Unless your solution is very similar to the one I posted 04/30/2007 : 06:49:32?Peter LarssonHelsingborg, Sweden |
 |
|
|
|
|
|