In Table2 i have 2 columns one is sno and another one is email2
In table2 i inserted the values through admin module.
In table1 i have columns like id,name,address,email1,refno etc.
When iam inserting the values in table1 programatically i need to check the values email1=email2. First time i have to insert the sno(in table2) as refno in table1. From second time onwards i have to insert the value as refno = max(refno) + 1...
Youll get a lot beter response on an MS-SQL question if you post it in the Microsoft SQL Server forum. In order to help people help you, you need to post the DDL for the tables (the CREATE TABLE statements), along with a few rows worth of examples of what data you'd like to process.