本文介绍了找到错误的解决方案...!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

select t2.tableName as 'Table Name',t2.gametype as 'Limit',Convert(varchar,Convert(numeric(18,2),t2.smallblind))
 + '/' + Convert(varchar,Convert(numeric(18,2),t2.bigblind)) as 'Stakes',t3.GameName as 'Game Name'
from tblgameinfo t1 join tblGameTables t2 on (t1.tableid=t2.tableid) join tblGames t3 on (t3.gameid = t1.gameid)
where (t2.skinid= 6 or t2.skinid= 0) and t1.nickname = 'Player1' --order by nickname

union all


Select t2.tablename as'Table Name',t1.TableID as 'Limit',t1.TournamentID as 'Stakes',t3.TournamentName'Game Name'
from tblRegistration t1 join tblGameTables_TRMNT t2 on t1.TableID=t2.TableID join tblTournaments t3 on t3.tournamentID=t1.TournamentID
where t3.skinid= 6 and t1.nickname='Player1' AND t1.Eliminated='N' and t1.TableID >-1 and t3.State='P' and t3.TournamentType='S'



如果我一次执行每个查询的话..!但是当我尝试执行
union All关键字会生成这样的错误..!



if i execute the each queary at a time its work..! but when i tried to execute with
union All keyword its generate a error like this..!

"Error converting data type varchar to numeric."


请告诉我如何管理查询!


please tell me how i have to manage queary!

推荐答案

select	t2.tableName as 'Table Name',
		t2.gametype as 'Limit',
		Cast(t2.smallblind as varchar) + '/' + Cast(t2.bigblind as varchar) as 'Stakes',
		t3.GameName as 'Game Name'
from 	tblgameinfo t1
join 	tblGameTables t2 on (t1.tableid=t2.tableid)
join 	tblGames t3 on (t3.gameid = t1.gameid)
where	(t2.skinid= 6 or t2.skinid= 0)
and		t1.nickname = 'Player1'
--order by nickname

union all
Select	t2.tablename as 'Table Name',
		t1.TableID as 'Limit',
		cast(t1.TournamentID as varchar) as 'Stakes',
		t3.TournamentName'Game Name'
from 	tblRegistration t1
join	tblGameTables_TRMNT t2 on t1.TableID=t2.TableID
join	tblTournaments t3 on t3.tournamentID=t1.TournamentID
where t3.skinid= 6
and t1.nickname='Player1'
AND t1.Eliminated='N'
and t1.TableID >-1
and t3.State='P'
and t3.TournamentType='S'




这篇关于找到错误的解决方案...!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 09:55