我需要构建一个从配置表中检索值的SQL Server 2012查询。代码如下所示:从查询中的配置表中检索值其中子句
Product
product_types product_description
001 Milk
002 Butter
003 Oatmeal
Configuration_table
product_nr
001
003
查询:
SELECT *
FROM product
WHERE product.types in (select product_nr from configuration_table)
只有001和003应该显示。但是这个查询没有结果。这怎么可以纠正?
感谢您的回复!
数据类型product.types和Configuration_table.product_nr? – jarlh
嗨jarlh感谢您的回复。 product_types和product_nr是nvarchar数据类型 – mgo
我想用整数代替。 – jarlh