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 |
|
sqldev6363
Yak Posting Veteran
54 Posts |
Posted - 2010-12-21 : 08:48:44
|
| I am using row_number() for the following scenario but i need to put them in different way..table1ID prov1 A1 B2 A2 A2 B3 B3 B3 A3 BTABLE2ID PART PRICE1 Y 123.01 N 0.02 Y 31.02 N 0.03 N 0.0...I NEED THE RESULT LIKE THIS TABLE3ID prov PRICE1 A 123.01 B 0.02 A 31.02 A 0.02 B 0.03 B 0.03 B 0.03 A 0.03 B 0.0IN TABLE2 FIELD 'Y' IN THE COLUMN PART WILL BE HAVING THE VALUE GREATER THAN 1 AND FOR THE FIELD 'N' WILL BE ALWAYS ZEROI AM USING ROW_NUMBER() AND USING LEFT JOIN TO JOIN 2 TABLES HERE ,BUT IN THE RESULT TABLE3 I AM GETTING ALL 0.0 IN THE PRICE COLUMN.PROBLEM IS THAT ONECAN ANY ONE HELP ME OUT IFOR THIS SCENARIO...THANKSdev |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2010-12-21 : 10:15:39
|
Use DENSE_RANK instead of ROW_NUMBER.And there is no need to shout. N 56°04'39.26"E 12°55'05.63" |
 |
|
|
|
|
|