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 |
|
Morris
Starting Member
3 Posts |
Posted - 2011-09-14 : 14:43:11
|
| I have been able to Compare when a price changes in the results and place the string 'Research' in a new column next to the price change. Now the client would like to have the term 'Research' to repeat for the rest of the results or until it changes again. I believe this may be solved by joining the table to itself but that logic seems to escape me. Any assistance would be helpful, Thank you.CURRENTIPK Price Action1 169.99 NULL2 169.99 NULL3 169.99 NULL4 169.99 NULL5 159.99 Research6 159.99 NULL7 159.99 NULL8 159.99 NULL9 159.99 NULLDesiredIPK Price Action1 169.99 NULL2 169.99 NULL3 169.99 NULL4 169.99 NULL5 159.99 Research6 159.99 Research7 159.99 Research8 159.99 Research9 159.99 Research |
|
|
memorykills
Starting Member
18 Posts |
Posted - 2011-09-14 : 14:47:44
|
| " to have the term 'Research' to repeat for the rest of the results or until it changes again" ??if it changes again, what will be displayed in the column? |
 |
|
|
Morris
Starting Member
3 Posts |
Posted - 2011-09-14 : 15:46:12
|
| Looking for Research to repeat for a week after it has changed again.I can work out some of the dates mainly I am having issues comparing records. IPK DATE Price Action1 1/1/2011 169.99 NULL2 1/2/2011 169.99 NULL3 1/3/2011 169.99 NULL4 1/4/2011 169.99 NULL5 1/5/2011 159.99 Research6 1/6/2011 159.99 Research 7 1/7/2011 159.99 Research8 1/8/2011 159.99 Research9 1/9/2011 169.99 Research10 1/10/2011 169.99 Research |
 |
|
|
Morris
Starting Member
3 Posts |
Posted - 2011-09-14 : 16:56:17
|
| I joined the table to itself off of DATE and in the join conditions used >= on the DATE Join.This seemed to get a running total of Research for me. Although its working I'm still working through why? I have a good handle on all kinds of joins and logic in SQL. For some reason joining a table to itself seems to make my mind go sideways. Anyone know of a simple and good resource for learning when and why you would do this? |
 |
|
|
|
|
|