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 |
|
beegee123
Starting Member
4 Posts |
Posted - 2006-03-18 : 18:35:36
|
| Hi,I just started database classToday is the first day i'm writtng code in sqlSO when i try to run this codeSELECT CUSTOMER.CUS_CODE,CUS_BALANCE, SUM(LINE_UNITS*LINE_PRICE) AS TotalPurchasesFROM CUSTOMER, INVOICE, LINEWHERE CUSTOMER.CUS_CODE=INVOICE.CUS_CODE AND INVOICE.INV_NUMBER=LINE.INV_NUMBERGROUP BY CUSTOMER.CUS_CODE;It says "You tried to execute quiry that does not include the specified expression 'CUS BALANCE' as a part of aggregate function.Please help me to fix it. |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-03-18 : 18:52:33
|
You will need to group by CUS_CODE and CUS_BALANCESELECT CUSTOMER.CUS_CODE, CUS_BALANCE, SUM(LINE_UNITS*LINE_PRICE) AS TotalPurchasesFROM CUSTOMER, INVOICE, LINEWHERE CUSTOMER.CUS_CODE = INVOICE.CUS_CODE AND INVOICE.INV_NUMBER = LINE.INV_NUMBERGROUP BY CUSTOMER.CUS_CODE, CUS_BALANCE KHChoice is an illusion, created between those with power, and those without.Concordantly, while your first question may be the most pertinent, you may or may not realize it is also the most irrelevant |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-03-18 : 18:54:48
|
Just saw your duplicate post here http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=63392Is this on MS SQL Server or Access ? KHChoice is an illusion, created between those with power, and those without.Concordantly, while your first question may be the most pertinent, you may or may not realize it is also the most irrelevant |
 |
|
|
beegee123
Starting Member
4 Posts |
Posted - 2006-03-18 : 18:56:06
|
| I am using ACCESS for it. |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-03-18 : 22:23:33
|
So does the script works for you ? KHChoice is an illusion, created between those with power, and those without.Concordantly, while your first question may be the most pertinent, you may or may not realize it is also the most irrelevant |
 |
|
|
|
|
|
|
|