我有一个名为“Date”的列,它是字符串数据类型。 2018年1月24日 2017年4月30日
如何找到字符串中这些日期的最大值?
我使用了这个没有返回预期最大值的查询
import java.io.Console;
import java.io.IOException;
import java.io.Reader;
public class GetChar {
public static void main(String args[]) {
int num=0;
Console c =System.console();
Reader r = c.reader();
try {
num= r.read();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println(num);
}
}
答案 0 :(得分:0)
尝试
SELECT a.id,
b.contract,
CAST (
TO_DATE (
from_unixtime (unix_timestamp (b.date, 'MM-dd-yyyy'))) AS DATE)
AS MAX_DATE
FROM acct a JOIN customer b ON (b.partyid = a.offerid)
WHERE CAST (
TO_DATE (
from_unixtime (unix_timestamp (b.date, 'MM-dd-yyyy'))) AS DATE) IN
( SELECT
MAX (
CAST (
TO_DATE (
from_unixtime (unix_timestamp (b.date, 'MM-dd-yyyy'))) AS DATE))
FROM acct a JOIN customer b ON (b.partyid = a.offerid)
WHERE b.contract = 200427747 );
编辑:在您提到的评论中,您需要获取最长日期的帐户详细信息。您可以使用此功能。
{{1}}