select top 20 *,
(select count(id) As qyid from product t where t.comID=a.comID ) as compnum,
(select companyName from company t where t.comID= a.comID ) as CompanyName from product a
---------------------------------------------------------------这样的一句
compnum,CompanyName,这几个别名统统的不会来,是0和null
------------------------------------------------------------但是泥
select top 20 *,
(select count(id) As qyid from product t where t.comID=a.comID ) as compnum
就有值
select top 20 *,
(select companyName from company t where t.comID= a.comID ) as CompanyName
也有值这就奇怪死了表结构如下product 表
id
comid
company 表
comid
companyname--------------------------------------------------------真奇怪啊