Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9246397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:28:39+00:00 2026-06-18T09:28:39+00:00

I am having trouble finding a solution for this question. Suggest any solution for

  • 0

I am having trouble finding a solution for this question. Suggest any solution for this question in PHP.

I have a table called test_repeat

id  start   repeater   length     final
 1   20       2           3         50
 2   10       50          4        500

and my query is

SELECT T.id AS ID, T.start AS start, T.repeater AS repeater 
       T.length AS length, T.final AS final
FROM `test_repeater` T
RIGHT JOIN `test_repeater` T2 ON T.id = T2.id 
WHERE T.start>=10 and T2.start*T2.repeater<=300

the result i’m getting is

ID  start  repeater   length    final    
1   20       2          3        50       
2   10       5          12       500    

What I am trying to get is the result in such a way that the each start value is added with the repeater and that makes that value as next raw until the final the conditions apply (please see below)

My dream result will be like this

   ID   start   repeater   length     final
   1     20       2           3         50
   1     22       2           3         50
   1     24       2           3         50
   1     ...      .           .         ...
   1     ...      .           .         ...
   1     50       2           3         50
   2     10       5           4         500
   2     15       5           4         500
   2     20       5           4         500
   2     25       5           4         500
   2     30       5           4         500
   2     35       5           4         500
   2     ...      .           .         ...
   2     ...      .           .         ...
   2     ...      .           .         ...
   2     500      5           4         500
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T09:28:41+00:00Added an answer on June 18, 2026 at 9:28 am

    OK. That makes more sense…

     DROP TABLE IF EXISTS test_repeat;
    
     CREATE TABLE test_repeat
     (id  INT NOT NULL AUTO_INCREMENT PRIMARY KEY
     ,start   INT NOT NULL
     ,repeater   INT NOT NULL
     ,length     INT NOT NULL
     ,final INT NOT NULL
     );
    
     INSERT INTO test_repeat VALUE
     (1,   20       ,2           ,3         ,50),
     ( 2   ,10       ,5          ,4        ,500);
    
    
     DROP TABLE IF EXISTS ints;
    
     CREATE TABLE ints(i INT NOT NULL PRIMARY KEY);
    
     INSERT INTO ints VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
    
    
    
     SELECT r.id
          , r.start+(r.repeater*(i2.i*10+i1.i)) start
          , repeater
          , length
          , final 
       FROM test_repeat r 
       JOIN ints i1
       JOIN ints i2
      WHERE r.start+(r.repeater*(i2.i*10+i1.i)) BETWEEN r.start AND r.final
      ORDER 
         BY id
          , start;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having trouble finding a solution to this problem. I have set up this
I'm having trouble finding a solution to this via google but I would have
I think this is a pretty simple question but I'm having trouble finding the
Ok, This seems straight forward but I am having trouble finding the solution. I
I'm having trouble finding the right solution for this fully fluid layout. I want
I'm having trouble finding a solution to this problem. I'm getting the error: rake
Having trouble finding a solution for my situation here. Sorry if this has been
I've done research on this problem, but am having trouble finding a solution. I
having a bit of trouble finding a solution to this. I want to take
I feel this should be a simple solution but I'm having trouble finding anything

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.