linq to sql 怎么查询三个表中(table1 table2 table3)并获得每张表里面的三个数
答案:2 悬赏:70 手机版
解决时间 2021-02-17 23:40
- 提问者网友:焚苦与心
- 2021-02-17 16:18
linq to sql 怎么查询三个表中(table1 table2 table3)并获得每张表里面的三个数据(登录名 密码 登录类型,每张表都有的)?
最佳答案
- 五星知识达人网友:时间的尘埃
- 2021-02-17 17:23
先为table1表的字段1a创建序列s_1a,然后insert into table1(1a,1b,1c) values();
for v_row in (Select t1.2b,t1.2c from table2 t1,table3 t2 where t1.2a=t2.3a and 3b>10) loop
insert into table1(1a,1b,1c) values(s_1a.nextval,v_row.2b,v_row.2c);
end loop;
后面的1d就不知道你是从哪取的值了。
for v_row in (Select t1.2b,t1.2c from table2 t1,table3 t2 where t1.2a=t2.3a and 3b>10) loop
insert into table1(1a,1b,1c) values(s_1a.nextval,v_row.2b,v_row.2c);
end loop;
后面的1d就不知道你是从哪取的值了。
全部回答
- 1楼网友:舊物识亽
- 2021-02-17 18:54
假设你的三个表全部都已经linq化(生成了对应的类,此类的datacontext叫做dbdatacontext):
using (dbdatacontext dbc = new dbdatacontext()) { var result = from t1 in dbc.table1 from t2 in dbc.table2 from t3 in dbc.table3 where (t1.autoid=22 && t1.parentid=t2.autoid && t2.parentid=t3.autoid) select new { t1id = t1.autoid, t1tn = t1.typename, t2id = t2.autoid, t2tn = t2.typename, t3id = t3.autoid, t3tn = t3.typename
}; }
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯