我有下表,我需要根据RESULT列中的值过滤该行。当结果为1然后选择该行。如果结果为0,则选择该特定国家/地区的最后一行。
Country Order START_TIME TARGET REQUEST RESPONSE RESULT
UK 1 17/03/2015 15:45 null <XML> content <XML> content 0
UK 2 17/03/2015 15:45 null <XML> content <XML> content 0
UK 3 17/03/2015 15:45 null <XML> content <XML> content 0
GERMANY 1 17/03/2015 15:45 null <XML> content <XML> content 1
SINGAPORE 1 18/03/2015 15:45 null <XML> content <XML> content 0
SINGAPORE 2 18/03/2015 15:45 null <XML> content <XML> content 0
SINGAPORE 3 18/03/2015 15:45 null <XML> content <XML> content 1
JAPAN 1 15/03/2015 15:45 null <XML> content <XML> content 0
JAPAN 2 15/03/2015 15:45 null <XML> content <XML> content 0
JAPAN 3 15/03/2015 15:45 null <XML> content <XML> content 0
AUSTRALIA 1 16/03/2015 15:45 null <XML> content <XML> content 0
AUSTRALIA 2 17/03/2015 15:45 null <XML> content <XML> content 0
AUSTRALIA 3 18/03/2015 15:45 null <XML> content <XML> content 0
CANADA 1 18/03/2015 15:45 null <XML> content <XML> content 0
CANADA 2 18/03/2015 15:45 null <XML> content <XML> content 0
VIETNAM 1 18/03/2015 15:45 null <XML> content <XML> content 1
THAILAND 1 18/03/2015 15:45 null <XML> content <XML> content 0
MALYASIA 1 18/03/2015 15:45 null <XML> content <XML> content 0
MALYASIA 2 18/03/2015 15:45 null <XML> content <XML> content 0
&#13;
以下是我需要的内容。我需要在Derby中执行此操作。
表的元数据
国家 - VARCHAR
订单 - INTEGER
开始时间 - TIMESTAMP
TARGET - VARCHAR
请求 - CLOB
回复 - CLOB
结果 - CHAR
Country Order START_TIME TARGET REQUEST RESPONSE RESULT
UK 3 17/03/2015 15:45 null <XML> content <XML> content 0
GERMANY 1 17/03/2015 15:45 null <XML> content <XML> content 1
SINGAPORE 3 18/03/2015 15:45 null <XML> content <XML> content 1
JAPAN 3 15/03/2015 15:45 null <XML> content <XML> content 0
AUSTRALIA 3 18/03/2015 15:45 null <XML> content <XML> content 0
CANADA 2 18/03/2015 15:45 null <XML> content <XML> content 0
VIETNAM 1 18/03/2015 15:45 null <XML> content <XML> content 1
THAILAND 1 18/03/2015 15:45 null <XML> content <XML> content 0
MALYASIA 2 18/03/2015 15:45 null <XML> content <XML> content 0
&#13;