这是我的表格(Scanner scn = new Scanner (System.in);
System.out.print("String text: "); //Text from user
String str= scn.nextLine();
str = str.replaceAll("\\s+","");
char[] cArray = text.toCharArray(); //Convert String to char array
for (int i = 0; i < cArray.length; i++)
{
for (int row = 0; row < charArray.length; row++)
{
for (int col = 0; col < charArray[row].length; col++)
{
System.out.println("i = " + i);
//charArray[row][col] = letters[i]; //I'm supposed to put in the converted String to char and put into the 2D Array of 6 by 6. When I executed the script, there is an array out of bound exception
System.out.println("charArray[" + row + "]" + "[" + col + "]" + "cArray[" + i + "]");
++i;
System.out.println("End of col for loop");
}
System.out.println("End of row for loop");
}
i = i;
}
System.out.println("End of i for loop");
,oratorId
)。一个quote
有一个或多个orator
(文字)
我想为此quote
选择唯一的oratorId
和最小长度quote
,但此orator
的长度应超过15个字符。
答案 0 :(得分:1)
试试这个:
SELECT oratorId, quote from (
SELECT t.*, ROW_NUMBER() OVER( PARTITION BY oratorId ORDER BY len) as rn FROM (
SELECT your_table.* , LENGTH(quote) AS len FROM your_table WHERE LENGTH(quote) > 15
) t
) tt
where rn = 1