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 |
|
AMB
Starting Member
6 Posts |
Posted - 2006-11-29 : 08:44:56
|
| Hi, I have a view of all quotes on our system which contains the quote number and the value of each item in the quote. I am trying to group the quotes so each entry only appears once. (NOt worried about the value field as there is a subtotal field that can be used in its place). An example would be......QuoteNo Subtotalquote001 54.52quote002 10.35quote002 10.35quote003 25.01quote004 31.23quote004 31.23quote004 31.23 I am trying to get it like this.....QuoteNo Subtotalquote001 54.52quote002 10.35quote003 25.10quote004 31.23Can anyone help?Thanks, AMB |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-11-29 : 08:47:50
|
| [code]Select QuoteNumber, max(subtotal) as SubTotalfrom Tablegroup by QuoteNumber[/code]Harsh AthalyeIndia."Nothing is Impossible" |
 |
|
|
Sean_B
Posting Yak Master
111 Posts |
Posted - 2006-11-29 : 08:48:57
|
| Have you tried doing select distinct QuoteNo, Subtotal from quotes ?Sean_B |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-11-29 : 08:50:00
|
or more simple:Select Distinct QuoteNumber, SubTotalfrom Table Harsh AthalyeIndia."Nothing is Impossible" |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|