如何为下表数据和条件创建一行SQL结果

时间:2019-02-22 09:36:05

标签: mysql sql

ID Name Action Starttime Endtime
 1  APAC    INST_GEN    30-JAN-19 12.20.48.237000000 PM 30-JAN-19 12.21.45.111000000 PM
 1  APAC    RESULTS_GEN 06-FEB-19 08.34.58.824000000 AM 06-FEB-19 08.35.22.694000000 AM
 1  APAC    ACCEPT_SUBMIS   30-JAN-19 03.55.56.837000000 PM 
 1  APAC    RESULTS_PUB 12-FEB-19 09.36.43.500000000 AM 12-FEB-19 09.37.36.950000000 AM
 1  APAC    TPL_PUB 30-JAN-19 12.22.37.820000000 PM 30-JAN-19 12.24.40.747000000 PM

如果动作= ACCEPT_SUBMIS然后在提交列中返回oepn,我如何在一行中输出

1 个答案:

答案 0 :(得分:0)

您可以使用WHERE的条件来输出单个行,例如:

SELECT ID, Name, Action, Starttime, Endtime, 'OPEN' AS submission 
WHERE Action = 'ACCEPT_SUBMIS';