Сравнение значений в двух разных таблицах
hi, I have two tables in my Database say t1 which is used as a reference table and table t2 which need to be compared, I have a scenario like my previous method returns say row no A of t1 now i need to check Particular columns say gram,milligram and kilogram columns in t1 with the same columns in my t2 and need to check whether my t1 values are less than the t2 values for the Particular columns, If my previous methods returns more than 1 row i need to check the same for all the rows which it has returned at once, how can i achieve this? I am using C# and SQL Ce
Что я уже пробовал:
private void btnSearch_Click(object sender, EventArgs e) { object result = dbCon.ExecuteReader("SELECT C.Type FROM Material_Declaration AS M INNER JOIN Total_Chemicals_List AS C ON M.CAS_Number = C.CAS_Number and M.CAS_Number <> 'No CAS' WHERE (M.Part_Number_ID = '" + txtPart.Text + "') AND (C.Type IS NOT NULL) "); if (result != null) { result = dbCon.ExecuteReader("SELECT Substance_Mass,Substance_Percentage FROM Material_DeclarationAS M WHERE EXISTS (SELECT Mass_in_mg, Weight FROM Total_Chemicals_ListAS C WHERE (M.Substance_Mass < C.Mass_in_mg) and (C.Type = " + result.ToString() + ")"); If (result != null) { ABC(); }