select Product_ID,Product_Name,Type3_ID from Product where Product.Type3_ID exists(select Type3_ID,Type2_ID from Product_Type3 where Product_Type3.Type2_ID exists(select Type2_ID,Type1_ID form Product_Type2 where Product_Type2.Type1_ID exists(select * from Product_Type1 where Product_Type1.Type1_ID=@type1 ) ) )
这是小弟写的sql语句,但是提示如下错误:关键字 'exists' 附近有语法错误。
关键字 'exists' 附近有语法错误。
'Product_Type2' 附近有语法错误。
')' 附近有语法错误。
这是小弟写的sql语句,但是提示如下错误:关键字 'exists' 附近有语法错误。
关键字 'exists' 附近有语法错误。
'Product_Type2' 附近有语法错误。
')' 附近有语法错误。
where exists
(select Type3_ID,Type2_ID from Product_Type3
where exists(
select Type2_ID,Type1_ID from Product_Type2
where exists
(select * from Product_Type1 where Product_Type1.Type1_ID=@type1 ) ) )
'Product_Type2' 附近有语法错误。
')' 附近有语法错误。
from Product
where Product.Type3_ID
in(select Type3_ID from Product_Type3 where Product_Type3.Type2_ID
in(select Type2_ID from Product_Type2 where Product_Type2.Type1_ID in (select Type1_ID from Product_Type1 where Product_Type1.Type1_ID=@type1 ) ) )用IN 试试。
我有四个表
Product_Type1 : Type1_ID,Type1_Name
Product_Type2 : Type2_ID,Type2_Name,Type1_ID
Product_Type3 : Type3_ID,Type3_Name,Type2_ID
Product :Product_ID,Product_Name,Type3_ID…
我在利用datalist的多层嵌套实现显示第二个表的时候同时等级显示Product表的相关内容,问一下这个sql语句怎么写啊???!@