日期:2014-05-18  浏览次数:20523 次

怎样串联查询结果?
SELECT [GroupID] FROM [sys_Group] where G_Delete=0 and G_ParentID=1 查询结果:
6
7
8

先要通过sql语句查询列出这样的结果:
dundiandanwei =6 or dundiandanwei =7 or dundiandanwei =8 

请问该怎么写,谢谢:)

------解决方案--------------------
try
SQL code
declare @s varchar(100)
SELECT 
  @s=isnull(@s+' or ','')+' dundiandanwei = '+ltrim([GroupID]) FROM [sys_Group] where G_Delete=0 and G_ParentID=1
select @s