0

我正在尝试搜索 sqlite 文件中的所有字段(列),但我并没有一直得到有效的结果。这是代码。我应该尝试不同的东西吗?

Select * From session
join sessiontype using(SESSIONTYPEID)
join camera on SESSION.[CameraID] = camera.CameraID
join chemicals on session.[DeveloperID] = chemicals.[ChemicalsID] 
               or session.[FixerID] = chemicals.[ChemicalsID]
join shop on session.[DEVELOPEDBYID] = shop.[ShopID]
join film on session.[FilmID] = film.[FilmID]
join vendor on film.[VendorID] = vendor.[VendorID]
where session.[Identifier] like('%agfa%') 
or session.[Notes] like('%agfa%')
or sessiontype.[SessionTypeName] like('%agfa%')
or camera.[CameraName] like('%agfa%')
or chemicals.[ChemicalsName] like('%agfa%')
or session.[DeveloperTemp] like('%agfa%')
or session.[DeveloperTime] like('%agfa%')
or session.[FixerTemp] like('%agfa%')
or session.[FixerTime] like('%agfa%')
or shop.[ShopName] like('%agfa%')
or session.[StopBathTemp] like('%agfa%')
or session.[StopBathTime] like('%agfa%')
or vendor.[VendorName] like('%agfa%')
order by session.[Identifier], sessiontype.[SessionTypeName], session.[Date]

我只有 1 个包含“agfa”的条目。以下行两次返回 1 条目:在 session.[DeveloperID] = Chemicals.[ChemicalsID] OR session.[FixerID] = Chemicals.[ChemicalsID] 上加入化学品

以下条目不返回任何结果:在 session.[DeveloperID] = Chemicals.[ChemicalsID] AND session.[FixerID] = Chemicals.[ChemicalsID] 上加入化学品

删除该行将返回正确的 1 条目。

4

1 回答 1

0
  1. 也许您想要/需要一些外部连接?
  2. 你在做甲骨文吗?一旦我对 JOIN 中的 OR 子句有一个奇怪的问题 - 它工作不正确 - 没有人知道为什么......通过将 JOIN(我更喜欢)转换为 WHERE 子句来做一个实验

注意:OR 和 LIKE 是非常昂贵的操作

于 2013-10-08T19:19:25.217 回答