asp sql数据库 同一表中 不同查询条件产生的 结果一起输出
如select*froma_companywherejingp='1'select*froma_companywherehot='1'select*froma_compa...
如 select * from a_company where jingp = '1'
select * from a_company where hot = '1'
select * from a_company where hy = '1'
将以上合并成一个记录集,
我用sql= "select * from (select * from a_company where jingp = '1' union select * from a_company where hot = '1' union select * from a_company where hy = '1'
)" 没有用啊!!这样做的主要是为了实现将VIP排在最前面,然后是推荐的,然后是普通的 展开
select * from a_company where hot = '1'
select * from a_company where hy = '1'
将以上合并成一个记录集,
我用sql= "select * from (select * from a_company where jingp = '1' union select * from a_company where hot = '1' union select * from a_company where hy = '1'
)" 没有用啊!!这样做的主要是为了实现将VIP排在最前面,然后是推荐的,然后是普通的 展开
2个回答
展开全部
select * from a_company where jingp = '1'
union all select * from a_company where hot = '1'
union all select * from a_company where hy = '1'
直接用这个阿,为什么还要包多一层呢?
union all select * from a_company where hot = '1'
union all select * from a_company where hy = '1'
直接用这个阿,为什么还要包多一层呢?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
select * from (select * from a_company where jingp = '1'
union all select * from a_company where hot = '1'
union all select * from a_company where hy = '1'
) as company
或者
select * from a_company where jingp = '1'
union all select * from a_company where hot = '1'
union all select * from a_company where hy = '1'
union all select * from a_company where hot = '1'
union all select * from a_company where hy = '1'
) as company
或者
select * from a_company where jingp = '1'
union all select * from a_company where hot = '1'
union all select * from a_company where hy = '1'
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询