USE [cms]
GO
/****** Object: StoredProcedure [dbo].[SpCateProductsInfo] Script Date: 10/14/2012 00:50:25 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER proc [dbo].[SpCateProductsInfo](@cate_id int)
as
begin
select sb.subcate_name, sum(p.qty) as totalqty,
(select top 1 pimg_mid1 from product join subcategory
on product.subcate_id=
(
select top 1 subcate_id
from subcategory
where cate_id=@cate_id
order by NEWID()
)
order by NEWID()) as pimg_mid1
from subcategory sb
join product p on p.subcate_id = sb.subcate_id
where sb.cate_id = @cate_id
group by sb.subcate_name
end
It is working f9, But the problem is that the pimg_mid1 column contains same entries (every row regarding the pimg_mid1 column contains same data)
can any one tell me abt this error and the solution ???