SQL在导出时更改值

时间:2017-08-21 23:35:48

标签: sql

我从我的数据库中拉出学生,他们的状态= 0我要导出的系统必须具有状态= 1。我可以获取查询以获取状态,但我不知道如何将其更改为1以导出到其他系统?

提前致谢!

select STUDENTS.FIRST_NAME as "firstname",
    STUDENTS.LAST_NAME as "lastname",
    STUDENTS.STUDENT_NUMBER as "idNumber",
    STUDENTS.ENROLL_STATUS as "status",
    STUDENTS.SCHOOLID as "school",
    STUDENTS.CLASSOF as "gradyear",
    U_DEF_EXT_STUDENTS.GSUITEEMAILADDRESS as "email" 
 from U_DEF_EXT_STUDENTS U_DEF_EXT_STUDENTS,
    STUDENTS STUDENTS 
 where U_DEF_EXT_STUDENTS.STUDENTSDCID=STUDENTS.DCID
        and STUDENTS.SCHOOLID =1992
        and STUDENTS.ENROLL_STATUS =0

1 个答案:

答案 0 :(得分:0)

您可以为状态

指定1
SELECT STUDENTS.FIRST_NAME as "firstname",
       STUDENTS.LAST_NAME as "lastname",
       STUDENTS.STUDENT_NUMBER as "idNumber",
       1 as "status", -- assign 1 to status
       STUDENTS.SCHOOLID as "school",
       STUDENTS.CLASSOF as "gradyear",
       U_DEF_EXT_STUDENTS.GSUITEEMAILADDRESS as "email" 
  FROM U_DEF_EXT_STUDENTS U_DEF_EXT_STUDENTS
 INNER JOIN STUDENTS STUDENTS 
    ON U_DEF_EXT_STUDENTS.STUDENTSDCID = STUDENTS.DCID
 WHERE STUDENTS.SCHOOLID = 1992
   AND STUDENTS.ENROLL_STATUS = 0