学习型 ASP/PHP/ASP.NET 主机 30元/年全能 ASP/PHP/ASP.NET 主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付
发新话题
打印

一条SQL语句的问题.在线等

一条SQL语句的问题.在线等

select * from product,UserInfo where product.typeID=UserInfo.UserNum and product.spec=5000 order by usein,pid desc
这样错了吗?其中product,UserInfo 是表名,product.typeID字段和UserInfo.UserNum字段一样,但是这样查不出结果
但少了and product.spec=5000 如下
select * from product,UserInfo where product.typeID=UserInfo.UserNum order by usein,pid desc
就可以查出来,请高手指教一下

TOP

没看出SQL有问题
会不会是Spec的类型与5000有问题的

TOP

“select * from product,UserInfo where product.typeID=UserInfo.UserNum order by usein,pid desc”执行这条语句由你想要的答案吗?

TOP

用另一种方法试试,join  on

TOP

应该 用连接  你着样 肯定有错误

TOP

必须用内连接

TOP

对,用内联接试试

TOP

用内联连接

TOP

你试试
select * from product,UserInfo where product.spec=5000 order by usein,pid desc
这样可以查处数据吗?
要是这样不行就是spec的类型和5000不配等的问题了……
积霜累寒始成冰,唯独河冰冰中冰。

TOP

发新话题