-1
我对sql有点低迷,所以这对我来说是新鲜事。SQL中的联合表
我从两个表中选择数据,做他们的工会
declare @randomlinkscards table
(cardTitleinfo nvarchar(max),
cardIdinfo bigint
)
declare @randomlinksvideos table
(
videotitle nvarchar(max),
videoid bigint
)
insert into @randomlinkscards(cardTitleinfo,cardIdinfo) select top 1 cardTable.cardTitle,cardTable.CardId from cardTable where is_active='True' order by newid()
insert into @randomlinksvideos(videotitle,videoid) select top 1 videos.title,videos.video_id from videos where is_active='True' order by newid()
select videotitle,videoid from @randomlinksvideos union all select * from @randomlinkscards
,因为它提供了我输出 -
从图像中可以看到,它返回两行。视频表
一行
一个cardTable
的行但是数据来作为我希望它是,但两行管理它是仍然存在的问题。
我想管理这一行中的所有数据。我如何尝试获取这一行中的数据
显示您的预期输出 – 2014-11-02 08:48:00
@Ganesh_Devlekar,我的预期成果是这两行 – Manoj 2014-11-02 08:49:28
我想你....分开希望两排的一排?然后删除union all'从@randomlinksvideos中选择videotitle,videoid; select * from @randomlinkscards;' – 2014-11-02 08:50:41