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 |
|
JasonAnt
Starting Member
23 Posts |
Posted - 2007-08-30 : 09:43:54
|
| Header Table: SalesNo, Customer, SalesDate, etcDetail Table: SalesNo, Item, Qty, UnitPriceSELECT a.SalesNo, a.Customer, sum( b.Qty * b.UnitPrice ) as TotAmountFROM tbHeader a inner join tbDetail bON tbHeader.SalesNo = tbDetail.SalesNoWHERE a.SalesDate = '1/1/2000' and TotAmount > 1000GROUP BY a.SalesNo, a.CustomerCause Error, whats wrong ?WHERE sum( b.Qty * b.UnitPrice ) > 1000 ..get same errorThanks |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-08-30 : 09:45:31
|
WHERE HAVING sum( b.Qty * b.UnitPrice ) > 1000 KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
JasonAnt
Starting Member
23 Posts |
Posted - 2007-08-30 : 09:53:52
|
| Its work, thank you KhTan |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-08-30 : 09:54:52
|
| orSelect * from(SELECT a.SalesNo, a.Customer, sum( b.Qty * b.UnitPrice ) as TotAmountFROM tbHeader a inner join tbDetail bON tbHeader.SalesNo = tbDetail.SalesNoWHERE a.SalesDate = '1/1/2000' GROUP BY a.SalesNo, a.Customer) as Twhere TotAmount > 1000MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|