我试图为每个 USERID 拉 2 行,第一行是最旧的日期(RSLVD_DTTM),第二行是最新的(RSLVD_DTTM)
这是我目前拥有的
USERID VIRTUAL_PROFILE LINE_STABILITY numb1 numb2 RSLVD_DTTM
USER1 STGR_al2_d7296-1184_u1088-256 STABLE "7,296" "20,074" 12/06/2012
USER1 STGR_al1_d12288-5056_u1088-256 STABLE "12,284""21,700" 08/01/2013
USER1 STGR_al1_d7296-1184_u1088-256 STABLE "7,292" "21,479" 06/11/2012
USER1 STGR_al1_d7296-1184_u1088-256 STABLE "7,292" "20,365" 03/04/2012
这是我希望输出的示例。
USERID VIRTUAL_PROFILE LINE_STABILITY_RATING numb1 numb2 RSLVD_DTTM
USER1 STGR_al1_d7296-1184_u1088-256 STABLE "7,292" "20,365" 03/04/2012
USER1 STGR_al1_d12288-5056_u1088-256 STABLE "12,284""21,700 08/01/2013
这是我的查询
select
USERID,
VIRTUAL_PROFILE,
LINE_STABILITY_RATING,
numb1,
numb2,
RSLVD_DTTM
from
symmktg.V_NDW_ACTUAL_SPEEDS, symmktg.VREMEDY_SYM_TICKET
where
USERID IS IN ('USER1')
and cast(RSLVD_DTTM as date) = '2013/03/23'
任何帮助,将不胜感激。