Microsoft Access查询生成表SQL

时间:2012-07-31 11:14:40

标签: sql ms-access

有人可以告诉我在Access SQL

中此语句中的where子句有什么问题
    SELECT * INTO [Enrolled Students]
    FROM [Candidate Details];
    Where Student ID  != 'rejected' OR 'pending' OR 'taster';

或者,如果可能,是否可以更正为IsNumeric(学生证)?

我似乎无法弄清楚

谢谢大家!

2 个答案:

答案 0 :(得分:2)

SELECT * INTO [Enrolled Students]
    FROM [Candidate Details]
    Where [Student ID] not in( 'rejected', 'pending' ,'taster');

答案 1 :(得分:1)

在MS Access中

SELECT * INTO [Enrolled Students]
    FROM [Candidate Details]
    Where [Student ID]  Not IN ("rejected","pending","taster");

如果学生ID可以包含“已拒绝”,那么它似乎是一个文本字段。在这种情况下,不是更方便,否则你不得不说:

Where [Student ID]  <> "rejected" And [Student ID] <> "pending" <...>