[英]Sql to compare a delimited string against known table of values to find mismatches
[英]Find mismatches values in the same row of a table
我有一個名為筆記本電腦的表,其中有多行。 我擁有的3個字段加上4個示例行是:
item_id | operating_system | item_title
-------+-------------+-------------
1 | Windows 10 | Toshiba with Windows 10 Pro and a mouse
2 | Windows 10 Pro | HP with Windows 10 Pro
3 | Linux | Dell with Windows 10
4 | iOS 11 | Random Apple laptop
我需要解決以下用例:
老實說,我對如何執行此操作頗為受阻,因此我開始了如下查詢:
SELECT * FROM laptops
WHERE item_name NOT LIKE ('%'+operating_system+'%')
但是我的SQL知識很有限,而且我不知道如何實現我介紹的2個用例。
怎么樣:
SELECT
item_name
FROM laptops
WHERE item_title NOT LIKE '%' || operating_system || '%'
例如,它將解決:
WHERE 'HP with Windows 10 Pro' NOT LIKE '%Windows 10 Pro%'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.