首页 新闻 会员 周边

请教高手~ef高级查询~~~

0
悬赏园豆:50 [已关闭问题] 关闭于 2016-01-29 15:00

最好是ef 查询  带分页的~~郁闷半天了~也不知道该怎么查询了~~请教大神们~~~

问题补充:

请帮我写下sql语句或者存储过程或者视图吧 ,谢谢了~

过客gg的主页 过客gg | 初学一级 | 园豆:62
提问于:2016-01-29 09:17
< >
分享
所有回答(5)
0

 建議使用導航屬性

JCdon | 园豆:2 (初学一级) | 2016-01-29 09:27
0

看看这篇博文把:分页、大数据分页都有的

http://www.cnblogs.com/wang7/archive/2012/08/13/2636850.html

Ctrl` | 园豆:3317 (老鸟四级) | 2016-01-29 09:52
0

这样的需求和设计本身就是不合理的,你一句写不完就写两句,两句写不完就写三句好了,

反正客户只要结果。

爱编程的大叔 | 园豆:30839 (高人七级) | 2016-01-29 10:48
0

一般联合查询都直接自己写 sql  了   或者用视图的方式,orm个人认为不适合做这些

_Arnold | 园豆:635 (小虾三级) | 2016-01-29 11:12
select distinct d.Name,d.content,e.s,f.Content,g.s2 from 
(select a.Name,c.content from a join b on a.uid = b.uid join c on b.pid = c.pid where a.Name = '张三' and c.content ='内容1')d,
(select COUNT(*) as s from a join b on a.uid = b.uid join c on b.pid = c.pid where a.Name = '张三' and c.content ='内容1' )e,
(select a.Name,c.content from a join b on a.uid = b.uid join c on b.pid = c.pid where a.Name = '张三' and c.content ='内容2')f,
(select COUNT(*) as s2 from a join b on a.uid = b.uid join c on b.pid = c.pid where a.Name = '张三' and c.content ='内容2')g

写出来了  但是又有什么意义   你这种结果应该不是直接用sql  select 出来的   应该是分步加载出来,

 

还有就是你要的结果也不存在   因为内容2 和张三对应的只有1条数据   你表中写的是3条数据   你对应关系理解错了吧

支持(0) 反对(0) _Arnold | 园豆:635 (小虾三级) | 2016-01-29 13:08
0

楼上正解

飞翔の金雕 | 园豆:364 (菜鸟二级) | 2016-01-29 13:35
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册