由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Database版 - 求教:数据操作
相关主题
question: copy first N rows from table B to table A (DB2)In toad,
[转载] Re: Database and XMLSimple DB question
database triggersadvanced skills in excel?
Access database sizedata warehouse里面,所有dimension table的数据要拷贝到新的fact table里面,觉得这做法比较傻。
How to populate data from text or MS ACCESS file to Oracle Database?VS2012 C# programing questions for record antomation test (转载)
Re: How to populate data from text or MS ACCESS file to Oracle Database?做SQL题目,心脏病险些发作
SQLServer2000 Database Structure Populat真服了老印
问一个crystal report的问题请教:找出10天内下了超过5次单的customers
相关话题的讨论汇总
话题: c2话题: c1话题: populated话题: statement话题: data
进入Database版参与讨论
1 (共1页)
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.
1 (共1页)
进入Database版参与讨论
相关主题
请教:找出10天内下了超过5次单的customersHow to populate data from text or MS ACCESS file to Oracle Database?
Re: How to find a duplicate record in AcRe: How to populate data from text or MS ACCESS file to Oracle Database?
how to find duplicates in mysqlSQLServer2000 Database Structure Populat
A weird error问一个crystal report的问题
question: copy first N rows from table B to table A (DB2)In toad,
[转载] Re: Database and XMLSimple DB question
database triggersadvanced skills in excel?
Access database sizedata warehouse里面,所有dimension table的数据要拷贝到新的fact table里面,觉得这做法比较傻。
相关话题的讨论汇总
话题: c2话题: c1话题: populated话题: statement话题: data