簡體   English   中英

如何在 Presto SQL 中使用 NOT LIKE 和 % 從搜索中排除項目?

[英]How to exclude items from search using NOT LIKE and % in Presto SQL?

我有以下查詢返回錯誤:不匹配的輸入“LIKE”。 期待:表達

select * from sales
where item_name NOT LIKE '%Tortoise%' 

下圖說明了我想從源數據中得到什么。 我想要不包含關鍵字“Tortoise”的記錄。

感謝有關如何更正此語法的任何建議,謝謝。

這可能會為您帶來預期的結果。

select * 
from sales
where item_name NOT IN (
   select * 
   from sales
   where item_name LIKE '%Tortoise%'
) 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM