I have a table of studies that includes unique StudiesID, title, abstract, author, subject, etc. I have created a report to help me QC newly entered study data. My coworkers give me a list of the Study IDs they have entered every month and I query the table of >100,000 records like this (additional fields removed for brevity):
我有一个研究表,包括独特的StudiesID,标题,摘要,作者,主题等。我创建了一份报告,以帮助我QC新输入的研究数据。我的同事给了我一个他们每月输入的研究ID列表,我查询了大约100,000条这样的记录表(为简洁起见,删除了其他字段):
SELECT QAQC_Studies.StudiesID, QAQC_Studies.NSL, QAQC_Studies.StudyTitle, QAQC_Studies.Abstract, QAQC_Studies.StudyStatus
FROM QAQC_Studies
WHERE [QAQC_Studies].[StudiesID]=26806 or 26845 or 100100 or 100110 or 100169
The query works fine for studies 26806, 26845, and 100110. But studies 100100 and 100169 don't show up in my query results. I've checked for spaces in those records and they look fine. Almost all of the entries above 100100 don't show up so it is weird that 100110 and also 100111 work fine. Any ideas on what I may be overlooking?
该查询适用于研究26806,26845和100110.但是研究100100和100169未显示在我的查询结果中。我检查了那些记录中的空格,它们看起来很好。几乎所有100100以上的条目都没有出现,所以100110和100111工作正常是很奇怪的。关于我可能会忽略的任何想法?
1 个解决方案
#1
2
if you want compare a set of values use in
如果你想比较一组使用的值
SELECT QAQC_Studies.StudiesID, QAQC_Studies.NSL,
QAQC_Studies.StudyTitle, QAQC_Studies.Abstract, QAQC_Studies.StudyStatus
FROM QAQC_Studies
WHERE [QAQC_Studies].[StudiesID] in (26806, 26845, 100100 , 100110 , 100169)
or add the column name to the or condition
或者将列名添加到条件中
SELECT QAQC_Studies.StudiesID, QAQC_Studies.NSL,
QAQC_Studies.StudyTitle, QAQC_Studies.Abstract, QAQC_Studies.StudyStatus
FROM QAQC_Studies
WHERE [QAQC_Studies].[StudiesID] =26806
OR [QAQC_Studies].[StudiesID] = 26845
OR [QAQC_Studies].[StudiesID] = 100100
OR [QAQC_Studies].[StudiesID] = 100110
OR [QAQC_Studies].[StudiesID] = 100169
#1
2
if you want compare a set of values use in
如果你想比较一组使用的值
SELECT QAQC_Studies.StudiesID, QAQC_Studies.NSL,
QAQC_Studies.StudyTitle, QAQC_Studies.Abstract, QAQC_Studies.StudyStatus
FROM QAQC_Studies
WHERE [QAQC_Studies].[StudiesID] in (26806, 26845, 100100 , 100110 , 100169)
or add the column name to the or condition
或者将列名添加到条件中
SELECT QAQC_Studies.StudiesID, QAQC_Studies.NSL,
QAQC_Studies.StudyTitle, QAQC_Studies.Abstract, QAQC_Studies.StudyStatus
FROM QAQC_Studies
WHERE [QAQC_Studies].[StudiesID] =26806
OR [QAQC_Studies].[StudiesID] = 26845
OR [QAQC_Studies].[StudiesID] = 100100
OR [QAQC_Studies].[StudiesID] = 100110
OR [QAQC_Studies].[StudiesID] = 100169