【发布时间】:2017-07-03 10:04:50
【问题描述】:
我又问了一个基本问题:
如果我这样做:
SELECT DISTINCT id, date, doctext, docline, from documentation where date in (02/14/2017)
doctext 是char(80),我无法更改它。此列的问题是大小,我无法保存> 80个字符的值,如果文档> 80个字符,它将在SQL中保存两行并升级文档
所以我的结果是,例如:
0 2017-02-14 this is a basic test to show you the result 0
1 2017-02-14 this is a new basic test to show you the result 0
2 2017-02-14 this is a long basic test to show you the result 0
2 2017-02-14 when the documentation have multiple lines 1
如果结果有多个具有相同 id 的行,我想要做的是连接 doctext 所以结果应该是:
0 2017-02-14 this is a basic test to show you the result
1 2017-02-14 this is a new basic test to show you the result
2 2017-02-14 this is a long basic test to show you the result when the documentation have multiple lines 1
是否可以根据 id 在一行上连接一列? 我正在尝试使用 CASE,例如:
CASE WHEN docline > 0 THEN DOCTEXT ...
我不知道如何指定我想要下一个 DOCTEXT
谢谢,
【问题讨论】: