z****a 发帖数: 3 | 1 想在DB2中实现以下数据操作,不知道是否有相应的Statement or Function:
Table A has 2 columns: c1 and c2. c1 already has data populated. c2 is empty.
I need to populate c2 with c1's data only when there's no duplicates. For
example: c1 has {a,a,b,c,c,d,e}. After running the SQL statement, c2 should be
populated with {"","",b,"","",d,e}. Is there any way to accomplish this?
Thanks for your help! | c**g 发帖数: 274 | 2 open a cursor.
【在 z****a 的大作中提到】 : 想在DB2中实现以下数据操作,不知道是否有相应的Statement or Function: : Table A has 2 columns: c1 and c2. c1 already has data populated. c2 is empty. : I need to populate c2 with c1's data only when there's no duplicates. For : example: c1 has {a,a,b,c,c,d,e}. After running the SQL statement, c2 should be : populated with {"","",b,"","",d,e}. Is there any way to accomplish this? : Thanks for your help!
| aw 发帖数: 127 | 3 没必要。
INSERT INTO T2
SELECT
CASE
WHEN value IN (SELECT value FROM T1 GROUP BY value HAVING COUNT(id)=1) THEN
value
ELSE ''
END
FROM
T1
empty.
should be
【在 c**g 的大作中提到】 : open a cursor.
|
|