这里数据库高手多啊,帮忙阿
create proc storeproc @c varchar(20)
select * from (
select a as aa,b as bb from tablea where a=@c
union
select c as aa,cc as bb from tableb where c=@c
) order by aa
union 的两个表字段的数据类型都一样的
是要建个存储过程,@c是传入参数
这样用好像不行啊,可我必须union后在排序,而且必须有参数
错误:order by 附近由于法错误
问题点数:20、回复次数:7Top
1 楼realljx(抵制日货 功在千秋)回复于 2004-09-03 16:00:23 得分 0
order by tablea.aa ?
Top
2 楼zjsen(位高权重责任轻,钱多事少离家近,睡觉睡到自然醒, 数钱数到手抽筋. )回复于 2004-09-03 16:01:04 得分 20
create proc storeproc
@c varchar(20)
as
select a as aa,b as bb from tablea where a=@c
union all
select c as aa,cc as bb from tableb where c=@c
order by aaTop
3 楼wangrenda(浪人)回复于 2004-09-03 16:02:51 得分 0
列名不名确,
为什么取一样额别名?Top
4 楼jamzh(Show me the money!!!)回复于 2004-09-03 16:02:53 得分 0
create proc storeproc @c varchar(20)
as
select * from (
select a as aa,b as bb from tablea where a=@c
union
select c as aa,cc as bb from tableb where c=@c
) order by aa
少了个as
Top
5 楼wangrenda(浪人)回复于 2004-09-03 16:03:45 得分 0
o,
看错了Top
6 楼BoroSoft(波波斯基)回复于 2004-09-03 16:07:39 得分 0
: zjsen(离开中...) ( ) 信誉:98 的对了,给分Top
7 楼xiedan79(Sam Xie)回复于 2004-09-03 16:15:32 得分 0
create proc storeproc @c varchar(20)
as (
select a as aa,b as bb from tablea where a=@c
union
select c as aa,cc as bb from tableb where c=@c
) order by aaTop




