gpt4 book ai didi

mysql - 如何在mysql查询中过滤非空值?

转载 作者:行者123 更新时间:2023-11-29 12:32:50 26 4
gpt4 key购买 nike

我有以下 mysql 查询。仅在 FK 上完成连接。

select le.lexicalentryid,  def.senseid, def.definitionid, frwf.writtenForm, trdef.writtentext, frwf.wordformid, frwf.phoneticForm, le.partofspeech, le.lexiconid
from formrepresentation_wordform frwf
left join wordform wf on wf.wordformid = frwf.wordformid
left join lexicalentry le on le.lexicalentryid = wf.lexicalentryid
left join sense se on se.lexicalentryid = le.lexicalentryid
left join definition def on def.senseid = se.senseid
left join textrepresentation_definition trdef on trdef.definitionid = def.definitionid
where frwf.languageidentifier like '%deu%'

我得到以下结果(我只显示前 4 个)

我想去掉空值。它们出现是因为对于相同的definitionid,我有一个书面形式。当发生这种情况时,我知道我必须从其他表中获取丢失的单词,所以现在我必须清除空值。

我试图添加到where子句frwf.writingForm is not null,但没有成功(所有的writingform列都变成了空白)

最佳答案

我已成功创建查询:

SELECT frl.writtenForm, frl.languageIdentifier, le.partOfSpeech, wf.idx, frw.phoneticForm, se._index, trd.writtenText
FROM FormRepresentation_Lemma frl
JOIN LexicalEntry le ON (frl.lemmaId = le.lemmaId)
JOIN WordForm wf ON (le.lexicalEntryId = wf.lexicalEntryId)
JOIN FormRepresentation_WordForm frw ON (frw.wordFormId = wf.wordFormId)
JOIN Sense se ON (le.lexicalEntryId = se.lexicalEntryId)
JOIN Definition de ON (se.senseId = de.senseId)
JOIN TextRepresentation_Definition trd ON (de.definitionId = trd.definitionId)
WHERE frl.languageidentifier like '%deu%'

我没有考虑到包含空值链接条目的 FormRepresentation_Lemma 表格

关于mysql - 如何在mysql查询中过滤非空值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27219532/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com