这是我到目前为止所得到的。我不知道如何在屏幕上打印最低和最高的数字。任何帮助将不胜感激。谢谢。
DECLARE @aracct VARCHAR(12)
SET @aracct = '49944928'
DECLARE @tran_id_pmt VARCHAR(6)
SET @tran_id_pmt = '147317'
SELECT '''',CONVERT(VARCHAR(8), transactions.item_no) AS item_no,'''','' FROM receivables_pmt INNER JOIN transactions
ON receivables_pmt.tran_id_paid = transactions.tran_id
WHERE aracct = @aracct AND tran_id_pmt = @tran_id_pmt
ORDER BY transactions.item_no
item_no
---- -------- ---- ----
' 1003 ',
' 1006 ',
' 1010 ',
' 1012 ',
}
答案 0 :(得分:2)
使用Java 8:
final Path path = Paths.get("LABEX10.txt");
try (Stream<String> lines = Files.lines(path)) {
final LongSummaryStatistics summary = lines
.mapToLong(Long::parseLong)
.summaryStatistics();
System.out.printf("range [%d .. %d]%n", summary.getMin(), summary.getMax());
}
这种方法比proposed duplicate更现代。