用SQL写Oracle翻页的时候提醒我未明确定义列。。

select*from(selecta.*,c.xm,d.*,rownumasnumfromhust_xs_jbaleftjoinHUST_XX_CLASSdond.bj... select * from

(
select a.*,c.xm,d.*,rownum as num from hust_xs_jb a
left join HUST_XX_CLASS d on d.bjbh=a.bjbh
inner join HUST_XX_IDENTITY b on b.sfid=a.sfid
inner join HUST_XX_PROFILE c on b.uuid=c.uuid
where a.sxlbm
in('25')
and (a.xjzt in('01','18','60') or a.xjzt is null) and a.bjbh is not null and d.nj is not null
and (c.hkyszss is null and c.gjm in ('156') ) or (c.gjm is null and c.hkyszss is null)

)
where num >= '50' and num <= '100'

中间括号内的那段语句单独可执行,没有问题。

是怎么回事呢
展开
 我来答
百度网友36cabda
2010-07-27 · TA获得超过298个赞
知道小有建树答主
回答量:493
采纳率:0%
帮助的人:317万
展开全部
因为你括号里的有*,可能是有重名的字段,括号外加个表的别名就好,如果括号内的*里有叫num的字段也不可以,要换个别名
select AA.* from

(
select a.*,c.xm,d.*,rownum as num from hust_xs_jb a
left join HUST_XX_CLASS d on d.bjbh=a.bjbh
inner join HUST_XX_IDENTITY b on b.sfid=a.sfid
inner join HUST_XX_PROFILE c on b.uuid=c.uuid
where a.sxlbm
in('25')
and (a.xjzt in('01','18','60') or a.xjzt is null) and a.bjbh is not null and d.nj is not null
and (c.hkyszss is null and c.gjm in ('156') ) or (c.gjm is null and c.hkyszss is null)

) AA
where AA.num >= '50' and AA.num <= '100'
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
金丝猴熊掌号
2010-07-30 · 超过14用户采纳过TA的回答
知道答主
回答量:60
采纳率:0%
帮助的人:39.8万
展开全部
楼主 看看执行以下这个 应该没问题:
select * from

(
select a.*,(c.xm) as xm2,d.*,rownum as num from hust_xs_jb a
left join HUST_XX_CLASS d on d.bjbh=a.bjbh
inner join HUST_XX_IDENTITY b on b.sfid=a.sfid
inner join HUST_XX_PROFILE c on b.uuid=c.uuid
where a.sxlbm
in('25')
and (a.xjzt in('01','18','60') or a.xjzt is null) and a.bjbh is not null and d.nj is not null
and (c.hkyszss is null and c.gjm in ('156') ) or (c.gjm is null and c.hkyszss is null)

)
where num >= '50' and num <= '100'

a 与 b 表中有相同名的字段 请区别开就没问题了~
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
cx924098
2010-07-27 · TA获得超过172个赞
知道小有建树答主
回答量:225
采纳率:0%
帮助的人:219万
展开全部
where num >= '50' and num <= '100 '
num 未明确定义!
select * from

(
select a.*,c.xm,d.*,rownum as num from hust_xs_jb a
left join HUST_XX_CLASS d on d.bjbh=a.bjbh
inner join HUST_XX_IDENTITY b on b.sfid=a.sfid
inner join HUST_XX_PROFILE c on b.uuid=c.uuid
where a.sxlbm
in('25')
and (a.xjzt in('01','18','60') or a.xjzt is null) and a.bjbh is not null and d.nj is not null
and (c.hkyszss is null and c.gjm in ('156') ) or (c.gjm is null and c.hkyszss is null)

) n
where n.num >= '50' and n.num <= '100 '
本回答被提问者和网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
shiwangxu
2010-07-27 · 超过25用户采纳过TA的回答
知道答主
回答量:196
采纳率:0%
帮助的人:68.3万
展开全部
select * from

(
select a.*,c.xm,d.*,rownum as num from hust_xs_jb a
left join HUST_XX_CLASS d on d.bjbh=a.bjbh
inner join HUST_XX_IDENTITY b on b.sfid=a.sfid
inner join HUST_XX_PROFILE c on b.uuid=c.uuid
where a.sxlbm
in('25')
and (a.xjzt in('01','18','60') or a.xjzt is null) and a.bjbh is not null and d.nj is not null
and (c.hkyszss is null and c.gjm in ('156') ) or (c.gjm is null and c.hkyszss is null)

) E
where num >= '50' and num <= '100 '
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
tacketlk
2010-07-27 · 超过30用户采纳过TA的回答
知道答主
回答量:71
采纳率:0%
帮助的人:82.6万
展开全部
括号内的查出来的字段重名了
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(3)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式