日期:2014-05-16  浏览次数:20496 次

这样的SQL能否实现?
tgids 里面装的是一个Id组,用空格隔开,和tgvalues里面ID 是一一对应的

id                       tgids                       tgvalues
1                        1 2 3                        7 8 9 
2                        3 5                          9 11


能否把里面值取出,显示如下

id                      tgid                          tgvalue
1                        1                             7
1                        2                             8
1                        3                             9
2                        3                             9
2                        5                             11

------解决方案--------------------
----------------------------------------------------------------
-- Author  :DBA_HuangZJ(发粪涂墙)
-- Date    :2014-04-29 13:11:21
-- Version:
--      Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (X64) 
-- Apr  2 2010 15:48:46 
-- Copyright (c) Microsoft Corporation
-- Enterprise Edition (64-bit) on Windows NT 6.2 <X64> (Build 9200: ) (Hypervisor)
--
----------------------------------------------------------------
--> 测试数据[huang]
if object_id('[huang]') is not null drop table&nbs