sql 语句 在查询的结果中在添加一列类型
select*fromdbo.t_BH_contentwhere@channelID='00001'unionallSELECTch.*FROMdbo.t_BH_cont...
select * from dbo.t_BH_content where @channelID='00001'
union all SELECT ch.* FROM dbo.t_BH_content ch
LEFT JOIN t_BH_RelChannel b ON b.f_content_ID=ch.f_content_ID
WHERE b.f_relchannel_ID='00001'
我想给 select * from dbo.t_BH_content where @channelID='00001'
添加一列type值都为1
给SELECT ch.* FROM dbo.t_BH_content ch
LEFT JOIN t_BH_RelChannel b ON b.f_content_ID=ch.f_content_ID
WHERE b.f_relchannel_ID='00001'
也添加一列type 值为2 怎么做阿 各位帮帮忙 展开
union all SELECT ch.* FROM dbo.t_BH_content ch
LEFT JOIN t_BH_RelChannel b ON b.f_content_ID=ch.f_content_ID
WHERE b.f_relchannel_ID='00001'
我想给 select * from dbo.t_BH_content where @channelID='00001'
添加一列type值都为1
给SELECT ch.* FROM dbo.t_BH_content ch
LEFT JOIN t_BH_RelChannel b ON b.f_content_ID=ch.f_content_ID
WHERE b.f_relchannel_ID='00001'
也添加一列type 值为2 怎么做阿 各位帮帮忙 展开
展开全部
select *,1 as Type from dbo.t_BH_content where @channelID='00001'
union all
SELECT ch.*,2 as Type FROM dbo.t_BH_content ch
LEFT JOIN t_BH_RelChannel b ON b.f_content_ID=ch.f_content_ID
WHERE b.f_relchannel_ID='00001'
这样就可以了
union all
SELECT ch.*,2 as Type FROM dbo.t_BH_content ch
LEFT JOIN t_BH_RelChannel b ON b.f_content_ID=ch.f_content_ID
WHERE b.f_relchannel_ID='00001'
这样就可以了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
select *,1 type from dbo.t_BH_content where @channelID='00001'
SELECT ch.*,2 type FROM dbo.t_BH_content ch
LEFT JOIN t_BH_RelChannel b ON b.f_content_ID=ch.f_content_ID
WHERE b.f_relchannel_ID='00001'
SELECT ch.*,2 type FROM dbo.t_BH_content ch
LEFT JOIN t_BH_RelChannel b ON b.f_content_ID=ch.f_content_ID
WHERE b.f_relchannel_ID='00001'
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询