用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'
中间括号内的那段语句单独可执行,没有问题。
是怎么回事呢 展开
(
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'
中间括号内的那段语句单独可执行,没有问题。
是怎么回事呢 展开
5个回答
展开全部
因为你括号里的有*,可能是有重名的字段,括号外加个表的别名就好,如果括号内的*里有叫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'
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'
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
楼主 看看执行以下这个 应该没问题:
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 表中有相同名的字段 请区别开就没问题了~
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 表中有相同名的字段 请区别开就没问题了~
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
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 '
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 '
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
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 '
(
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 '
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
括号内的查出来的字段重名了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询