union all 返回
SqlSugar
老数据
3
2376
悬赏:5 飞吻
MYSQL 写法: 通过手机号,判断在企业表和用户表中是否存在。
select sum(C) as `Sum` from (
select count(CompanyId) as C from company where MobilePhone =@Phone
union all
select count(UserId) as C from userinfo where LoginName = @Phone
) as R
这种在ORM中怎么写啊 ~.~
热忱回答(3)
-
fate stay night VIP0
2019/4/23Db.unionall
0 回复 -
秉冬将至 VIP0
2019/4/23
按照Db.unionall实现的话,就报这个错误。因为连接的2个不同的实体(企业表和用户表)。在SQL中 我能
这样写,拿到想要的数据。在SqlSugarCore里,
就是分2次查询,最后在程序里判断。0 回复 -
fate stay night VIP0
2019/4/23Select 的类型一样就可以了
0 回复