select a.* , b.mc from enterprise_zw as a inner join enterprise_jbxx as b on(a.enterprise_id=b.id) where a.publishflag = 1 order by a.publishtime desc 如果同一个b.mc有几条数据,我只想得到b.mc当中的最后一条数据.这条语句还要怎么改??
解决方案 »
- siteFactory3.6和Discuz!NT3.6 怎么给它们进行注册 登陆 退出等的整合整合
- 有关接收变量的问题
- 无法调试开发asp.netweb应用程序,调试报错说无法在web服务器上启动调试,重叠i/o操作在进行中,怎么解决,急啊
- 关于Repeater中嵌套Repeater的问题
- linkbutton都失效了(页面上没有验证控件)
- 100分求如何转把表1中的字段转成表2中的字段
- 高版本的vs.net做的.net程序不能用低版本的vs.net 打开
- 数据库语句小问题
- 如何通过asp.net来发送手机短信????
- 关于列不属于XX表
- 关于button按钮的问题
- asp.net源代码隐藏的问题
select top 1 ...
(select top 1 from enterprise_jbxx)
order by a.publishtime
(select top 1 id from enterprise_jbxx)
order by a.publishtime
如果不相同还是要显示
select a.* , b.mc from enterprise_zw as a inner join enterprise_jbxx as b on(a.enterprise_id=b.id)
where a.publishflag = 1
and exists(select a2.publishtime from enterprise_zw as a2 inner join enterprise_jbxx as b2 on(a2.enterprise_id=b2.id)
where a.enterprise_id=a2.enterprise_id
group by a2.publishtime
having a.publishtime=min(a2.publishtime))
order by a.publishtime desc
and exists(
select b2.id from enterprise_zw as a2 inner join enterprise_jbxx as b2 on(a2.enterprise_id=b2.id)
where b.id=b2.id
group by b2.id
having b.mc=min(b2.mc)
)
不好意思让大家绕了这么远。。