“选择"带有“有序对". [英] "Select in" with "ordered pairs"
本文介绍了“选择"带有“有序对".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个像这样的表结构.
I have a table structure like this.
ProductCR productID ProductName
09 1553 A1
09 1600 A2
09 1800 A3
10 1553 A4
10 1600 A5
10 2000 A6
我想做这样的事情:
Select ProductoName from Products where (ProductCR,ProductID) in ((09,1553),(10,1600),(10,2000))
Result:
A1
A5
A6
在Sql Server中这是可能的吗?这样的选择"与有序对"? 谢谢, 维克多.
Is this posible in Sql Server?? such a "select in" with "ordered pairs"?? Thanks, Victor.
推荐答案
Oracle allows that, but SQL Server does not. You'll have to write it out:
select ProductoName
from Products
where ProductCR = 09 and ProductID = 1553 or
ProductCR = 10 and ProductID = 1600 or
ProductCR = 10 and ProductID = 2000
这篇关于“选择"带有“有序对".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文