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 |
|
nguyenl
Posting Yak Master
128 Posts |
Posted - 2009-06-09 : 12:54:30
|
| Hi,I have an application where the data sets consists of a Parcel number, an annual interest rate, and an annual percentage rate. Some parcel numbers have both annual interest rates, some only have annual ineterest rates. with the parcel numbers that have both, instead of creating a table placing the annual interest and annual pertage rates on one same data row. The vendor created 2 seperate data rows. For example:calulation.Parcel Number: 20394 calculation.annualinterestrate : 20 calculation.annualpercentagerate: NULLcalulation.Parcel Number: 20394 calulation.annual interest rate : NULL calulation.annual percentage rate: 30I would like it to be on the same data row, because it it is the same parcel number:for example: calulation.Parcel Number: 20394 calulation.annual interest rate : 20 calulation.annual percentage rate: 30Please help.Thanks |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-06-09 : 12:58:26
|
| [code]SELECT [Parcel Number],MAX([annual interest rate]),MAX([annual percentage rate])FROM YourTableGROUP BY [Parcel Number][/code] |
 |
|
|
nguyenl
Posting Yak Master
128 Posts |
Posted - 2009-06-09 : 17:39:35
|
| sorry. I didn't mention that when I run the query I get over 100,000 records. Some Parcels have annual interest rate, and some don't. Some have both, but instead of just updating the annual interest rate column of that specific parcel ( and vice versa), the vendor created a whole new record for it. For example:calulation.Parcel Number: 20394calculation.annualinterestrate : 20calculation.annualpercentagerate: NULLcalulation.Parcel Number: 20394calulation.annual interest rate : NULLcalulation.annual percentage rate: 30it shoould be:calulation.Parcel Number: 20394calulation.annual interest rate : 20calulation.annual percentage rate: 30 |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-06-10 : 13:55:20
|
quote: Originally posted by nguyenl sorry. I didn't mention that when I run the query I get over 100,000 records. Some Parcels have annual interest rate, and some don't. Some have both, but instead of just updating the annual interest rate column of that specific parcel ( and vice versa), the vendor created a whole new record for it. For example:calulation.Parcel Number: 20394calculation.annualinterestrate : 20calculation.annualpercentagerate: NULLcalulation.Parcel Number: 20394calulation.annual interest rate : NULLcalulation.annual percentage rate: 30it shoould be:calulation.Parcel Number: 20394calulation.annual interest rate : 20calulation.annual percentage rate: 30
so do you mean you want to retrive them as single record, which is what i gave you earlier or do you mean to remove the extra record from table after copying the other column info to first record? |
 |
|
|
|
|
|
|
|