需要帮助查询 [英] need help with the query
本文介绍了需要帮助查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我想让出售个人电脑而不是笔记本电脑的制造商,所需的输出为E,请参考附件以获取表格结构
Hi
I want to get the maker who sells pc but not laptops the desired output is E,pl refer the attached file for the table structure
product
maker model type
A 1232 PC
A 1233 PC
A 1276 Printer
A 1298 Laptop
A 1401 Printer
A 1408 Printer
A 1752 Laptop
B 1121 PC
B 1750 Laptop
C 1321 Laptop
D 1288 Printer
D 1433 Printer
E 1260 PC
E 1434 Printer
E 2112 PC
E 2113 PC
推荐答案
我认为这可能是适合您的解决方案仅给出答案为"E"
I think this might be the right solution for you which will give answer as ''E'' only
SELECT distinct(maker)
FROM Product
WHERE type = 'pc'
except
SELECT distinct(maker)
FROM product
WHERE type = 'laptop';
试试吧,让我知道它是否有效.
try it and let me know if it works or not.
SELECT * FROM Product WHERE type not in ('Laptop')
希望这会有所帮助,如果是,那么请接受并投票答复.任何对此的任何疑问/问题都将受到欢迎.
谢谢&问候
RDBurmon.Sr.Software工程师
Hope this helps , If yes then plz accept and vote the answer. Any queries / questions on this are always welcome.
Thanks & Regards
RDBurmon.Sr.Software Engineer
亲爱的朋友,
希望这能奏效.
Dear Friend,
Hope this will work.
Select * from My_Table with (Nolock) where type='PC' and maker not in (Select maker from My_Table with (Nolock) where type='Laptop')
问候,
AP
Regards,
AP
这篇关于需要帮助查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文