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 |
|
Hommer
Aged Yak Warrior
808 Posts |
Posted - 2006-04-26 : 15:01:22
|
| Somebody please help me on this one. Thanks.select accountID, atp.account_name, atp.contact_sale_name, Max(distinct jt.DateEntered) AS LastOrdDate, count(distinct jt.co_number) TotalJobs, Sales_Since_05=(select sum(amt), OrdID from Orders where DateEntered >'2005-01-01' group by OrdID) a from address atp join jobtracking jt on atp.account_number=jt.accountnumber join a on a.OrdID= jt.order_nbrgroup by account_number, atp.account_name, atp.contact_sale_name, atp.address_line1, a.Sales_Since_05I have tried to put the sales_since_05 into select list or from clause, but neither worked. |
|
|
Hommer
Aged Yak Warrior
808 Posts |
Posted - 2006-04-26 : 15:30:57
|
| got it working. Moved the sub query in from, like thisa.saleso5from tbl1 join tbl2 on...join (select sum() as sales05...) a on ...group by ...a.sales05 |
 |
|
|
|
|
|