Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Reeteshjain
Starting Member
1 Post |
Posted - 2007-01-13 : 08:15:45
|
Hi All, I am new in the Fourm. I have a one Problem. I have a two select stament that are return 2-2 column that are in the differnent table. I want that return in one table......Ex I am writing 2 select statment below.. 1. select count(product.ProductID) as productCount,AffiliateHits.affiliateID,product.Name as [Name],product.ProductID from AffiliateHits,product where AffiliateID like 'SELF'--@affiliateID and product.ProductID=AffiliateHits.ProductID group by product.ProductID,AffiliateHits.affiliateID,product.Name 2. select count(*)as OrderCount,orderdetail.productid from [order],OrderDetail where [order].sourceID like @affiliateID and [order].addedon between @fromDate AND @toDate AND [order].orderID=OrderDetail.orderid AND OrderDetail.ProductID in (select distinct(productid)from AffiliateHits where AffiliateID like @affiliateID) group by orderdetail.ProductID Plz Reply asap. ThankxHard word is Success of a life |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-01-13 : 08:26:52
|
select count(product.ProductID) as productCount,AffiliateHits.affiliateID,product.Name as [Name],product.ProductID from AffiliateHits,productwhere AffiliateID like 'SELF'--@affiliateIDand product.ProductID=AffiliateHits.ProductIDgroup by product.ProductID,AffiliateHits.affiliateID,product.Name UNION ALLselect count(*)as OrderCount,orderdetail.productid from [order],OrderDetailwhere [order].sourceID like @affiliateID and [order].addedon between @fromDate AND @toDate AND [order].orderID=OrderDetail.orderid ANDOrderDetail.ProductID in (select distinct(productid)from AffiliateHits where AffiliateID like @affiliateID)group by orderdetail.ProductIDPeter LarssonHelsingborg, Sweden |
 |
|
|
|
|
|
|