Is there a way to repeat a value until other is found in SQLAdd a column with a default value to an existing table in SQL ServerWhat is the best way to paginate results in SQL ServerSelect columns from result set of stored procedureFinding duplicate values in a SQL tableAdd default value of datetime field in SQL Server to a timestampSQL select only rows with max value on a columnHow does PHP 'foreach' actually work?Get records with max value for each group of grouped SQL resultsCopy value into rows below until greater value is found in SQLSQL - Repeat the last known value until yesterday
What are the differences between credential stuffing and password spraying?
If I readied a spell with the trigger "When I take damage", do I have to make a constitution saving throw to avoid losing Concentration?
Why is B♯ higher than C♭ in 31-ET?
I have a unique character that I'm having a problem writing. He's a virus!
Understanding trademark infringements in a world where many dictionary words are trademarks?
Would Hubble Space Telescope improve black hole image observed by EHT if it joined array of telesopes?
Why was the battle set up *outside* Winterfell?
Using a microphone from the 1930s
What does a spell range of "25 ft. + 5 ft./2 levels" mean?
Randomness of Python's random
I need a disease
Which module had more 'comfort' in terms of living space, the Lunar Module or the Command module?
What was the design of the Macintosh II's MMU replacement?
Getting a W on your transcript for grad school applications
How should I tell my manager I'm not paying for an optional after work event I'm not going to?
Upside-Down Pyramid Addition...REVERSED!
Can there be a single technologically advanced nation, in a continent full of non-technologically advanced nations?
Have I damaged my car by attempting to reverse with hand/park brake up?
How do LIGO and VIRGO know that a gravitational wave has its origin in a neutron star or a black hole?
How to change lightning-radio-group selected value programmatically?
Did we get closer to another plane than we were supposed to, or was the pilot just protecting our delicate sensibilities?
Pressure inside an infinite ocean?
What matters more when it comes to book covers? Is it ‘professional quality’ or relevancy?
Why do people keep telling me that I am a bad photographer?
Is there a way to repeat a value until other is found in SQL
Add a column with a default value to an existing table in SQL ServerWhat is the best way to paginate results in SQL ServerSelect columns from result set of stored procedureFinding duplicate values in a SQL tableAdd default value of datetime field in SQL Server to a timestampSQL select only rows with max value on a columnHow does PHP 'foreach' actually work?Get records with max value for each group of grouped SQL resultsCopy value into rows below until greater value is found in SQLSQL - Repeat the last known value until yesterday
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I want to know if is possible to repeat the value of the current row until I found another one and then repeat that
I have tried some function with CASE WHEN or OPERATION with ROW_NUMBER but I cant do much
WHEN DATE=201903 always is going to be the value of act_CODE and that's the first value is going to put in the result
sql sql-server loops
add a comment |
I want to know if is possible to repeat the value of the current row until I found another one and then repeat that
I have tried some function with CASE WHEN or OPERATION with ROW_NUMBER but I cant do much
WHEN DATE=201903 always is going to be the value of act_CODE and that's the first value is going to put in the result
sql sql-server loops
1
I don't fully understand the logic. What if there is aNULL
values between 15 and 21? Which does it get?
– Gordon Linoff
Mar 22 at 22:15
it takes the value 21 until 15 is found then all rows from there going to have 15
– Marcos M Soriano A
Mar 22 at 22:22
2
I think this is a gaps and islands question? I think the data we have is the data the OP received from a query we don't have, and the results they are after. We really need sample data and expected results for that data.
– Larnu
Mar 22 at 22:26
Can you put your test query to check what you have try so for.
– Saket Yadav
Mar 23 at 3:19
add a comment |
I want to know if is possible to repeat the value of the current row until I found another one and then repeat that
I have tried some function with CASE WHEN or OPERATION with ROW_NUMBER but I cant do much
WHEN DATE=201903 always is going to be the value of act_CODE and that's the first value is going to put in the result
sql sql-server loops
I want to know if is possible to repeat the value of the current row until I found another one and then repeat that
I have tried some function with CASE WHEN or OPERATION with ROW_NUMBER but I cant do much
WHEN DATE=201903 always is going to be the value of act_CODE and that's the first value is going to put in the result
sql sql-server loops
sql sql-server loops
edited Mar 22 at 22:14
Gordon Linoff
804k37323430
804k37323430
asked Mar 22 at 22:12
Marcos M Soriano AMarcos M Soriano A
1
1
1
I don't fully understand the logic. What if there is aNULL
values between 15 and 21? Which does it get?
– Gordon Linoff
Mar 22 at 22:15
it takes the value 21 until 15 is found then all rows from there going to have 15
– Marcos M Soriano A
Mar 22 at 22:22
2
I think this is a gaps and islands question? I think the data we have is the data the OP received from a query we don't have, and the results they are after. We really need sample data and expected results for that data.
– Larnu
Mar 22 at 22:26
Can you put your test query to check what you have try so for.
– Saket Yadav
Mar 23 at 3:19
add a comment |
1
I don't fully understand the logic. What if there is aNULL
values between 15 and 21? Which does it get?
– Gordon Linoff
Mar 22 at 22:15
it takes the value 21 until 15 is found then all rows from there going to have 15
– Marcos M Soriano A
Mar 22 at 22:22
2
I think this is a gaps and islands question? I think the data we have is the data the OP received from a query we don't have, and the results they are after. We really need sample data and expected results for that data.
– Larnu
Mar 22 at 22:26
Can you put your test query to check what you have try so for.
– Saket Yadav
Mar 23 at 3:19
1
1
I don't fully understand the logic. What if there is a
NULL
values between 15 and 21? Which does it get?– Gordon Linoff
Mar 22 at 22:15
I don't fully understand the logic. What if there is a
NULL
values between 15 and 21? Which does it get?– Gordon Linoff
Mar 22 at 22:15
it takes the value 21 until 15 is found then all rows from there going to have 15
– Marcos M Soriano A
Mar 22 at 22:22
it takes the value 21 until 15 is found then all rows from there going to have 15
– Marcos M Soriano A
Mar 22 at 22:22
2
2
I think this is a gaps and islands question? I think the data we have is the data the OP received from a query we don't have, and the results they are after. We really need sample data and expected results for that data.
– Larnu
Mar 22 at 22:26
I think this is a gaps and islands question? I think the data we have is the data the OP received from a query we don't have, and the results they are after. We really need sample data and expected results for that data.
– Larnu
Mar 22 at 22:26
Can you put your test query to check what you have try so for.
– Saket Yadav
Mar 23 at 3:19
Can you put your test query to check what you have try so for.
– Saket Yadav
Mar 23 at 3:19
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55308443%2fis-there-a-way-to-repeat-a-value-until-other-is-found-in-sql%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55308443%2fis-there-a-way-to-repeat-a-value-until-other-is-found-in-sql%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
I don't fully understand the logic. What if there is a
NULL
values between 15 and 21? Which does it get?– Gordon Linoff
Mar 22 at 22:15
it takes the value 21 until 15 is found then all rows from there going to have 15
– Marcos M Soriano A
Mar 22 at 22:22
2
I think this is a gaps and islands question? I think the data we have is the data the OP received from a query we don't have, and the results they are after. We really need sample data and expected results for that data.
– Larnu
Mar 22 at 22:26
Can you put your test query to check what you have try so for.
– Saket Yadav
Mar 23 at 3:19