I'm not coding it for you!
The way I would have done it, if resource use was not an issue, and it was 100 or less rows in the tables, was to load the relevant table(s) into a DataSet
] and search through all rows in the first column (not the record ID column if it has one), if the first fits compare each relavant field on the row using
and should all match, then return error message or whatever you want.
Now I use C# for desktop so I don't need to worry to much about resources, but if this is on a website calling another websites SQL server, it's not a good fix.
hope this was helpful!
PS: feel free to comment on this if I'm missing the point of the question entirely