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;








0















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



this is what I get



this is the result I want










share|improve this question



















  • 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

















0















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



this is what I get



this is the result I want










share|improve this question



















  • 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













0












0








0








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



this is what I get



this is the result I want










share|improve this question
















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



this is what I get



this is the result I want







sql sql-server loops






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 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












  • 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







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












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
);



);













draft saved

draft discarded


















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















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현