在一个表中,"select id from table1 where a=1 " 得到的id有一到多条记录,假设是3条记录(record[3])为1,2,3,第一、C#里怎么取到这三条记录?用数组保存吗?取得的这些记录在另一个表需要作出判断,"select count(*) from table2 where b=record[0] and endtime IS NULL" 如果count(*)有记录则退出, 没有则"select count(*) from table2 where b=record[1] and endtime IS NULL"如果count(*)有记录则退出,以此类推,第二该怎么写第二个判断比较高效合理?谢谢!
{
//...
}若是DataTable dtfor(int i=0;i<dt.Rows.Count;i++)
{
//...
}
这是高效的
select COUNT(*) from table1 t1 INNER JOIN table2 t2 ON t1.id=t2.b where t1.a=1