我试图将不同的行合并为一个,因为它们在Microsoft sql中具有相同的id但不同的列值。我找到了关于相同需求的讨论,但在oracle中看到link
中创建了表格例如,我有
UserId WorkGroup
Bill PC-money
Bill PC-windows
Linus PC-free
Linus PC-open
我想看看
UserId WorkGroup1 WorkGroup2
Bill PC-money PC-windows
Linus PC-free PC-open
我对microsoft sql的访问权限是只读的
感谢您的想法
答案 0 :(得分:0)
SELECT USERID,
SUBSTRING_INDEX(SUBSTRING_INDEX(GROUP_CONCAT(WORKGROUP), ',', 1), ',', -1) AS WORKGROUP1,
if(length(GROUP_CONCAT(WORKGROUP)) - length(replace(GROUP_CONCAT(WORKGROUP), ',', ''))>=1,
SUBSTRING_INDEX(SUBSTRING_INDEX(GROUP_CONCAT(WORKGROUP), ',', 2), ',', -1) ,
NULL)WORKGROUP2
FROM MyTable1
GROUP BY USERID;
您可以在此处查看SQL Fiddle Demo。
考虑到每个USERID
都有两个条目,您可以尝试以上查询。
答案 1 :(得分:0)
:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no
previous execution, etc.).
file or directory '/tmp/build4365298428607247775xxx/Main/src/debug/java', not found
Compiling with JDK Java compiler API.
/tmp/build4365298428607247775xxx/Main/src/main/java/com/<hidden this package name for privacy>/salestraining/MainStub.java:176: error: cannot find symbol
Display.getInstance().callSerially(new Runnable() { public void run() {i.destroy();} });
^
symbol: method destroy()
location: variable i of type Main
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
:compileDebugJavaWithJavac FAILED
:compileDebugJavaWithJavac (Thread[Daemon worker,5,main]) completed. Took 7.165 secs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.