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 |
|
bommer87
Starting Member
2 Posts |
Posted - 2008-08-12 : 22:11:05
|
| Table has these fieldsISBNTITLEPUBDATEPUBIDCOSTRETAILCATEGORY----------Here is sample data9247381001HOW TO MANAGE THE MANAGER09-MAY-99115.431.95BUSINESS----------------------------SQL> select category, TO_CHAR(sum(retail),'$9999.00') as "Total Retail", TO_CHAR(AVG(retail),'$9999.00') as "Average Retail" from books group by category;CATEGORY Total Retail Average Retail------------ --------- ---------COMPUTER $211.40 $52.85COOKING $48.70 $24.35CHILDREN $68.90 $34.45LITERATURE $39.95 $39.95BUSINESS $31.95 $31.95FITNESS $30.95 $30.95FAMILY LIFE $111.95 $55.98SELF HELP $29.95 $29.958 rows selected.--------------I need to show only those with Total Retail > 40 cannot get that to work. |
|
|
dexter.knudson
Constraint Violating Yak Guru
260 Posts |
Posted - 2008-08-12 : 23:02:28
|
| This looks like ORACLE SQL, this is a Microsoft SQL Server forum.However, Add- HAVING "Total Retail" > 40If this doesn't work, you may need-TO_CHAR(sum(retail),'$9999.00') |
 |
|
|
bommer87
Starting Member
2 Posts |
Posted - 2008-08-12 : 23:22:14
|
| Yes this is Oracle SQL didnt mean to post in wrong forum. The good news is it worked with HAVING sum(retail) > 40. Thanks for the help. |
 |
|
|
|
|
|