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

  • SEARCH
  • Home
  • 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 7049913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:04:45+00:00 2026-05-28T03:04:45+00:00

Is it possible to select one row in MySQL and then miss 4 rows

  • 0

Is it possible to select one row in MySQL and then miss 4 rows and then miss 3 rows and then miss 5 rows and then loop this until the end of the table?

I have found some LIMIT and OFFSET tutorials online, they work but, are only good for one off set. I need multiple.

I currently have this setup to work in PHP but I feel my PHP code is bloated because I only know a basic way of achieving this.

My PHP code is as follows

    $int_count = 0;
$result = mysql_query("SELECT * FROM guitar_tunings_chords WHERE note_id >= '27'");
while ( $row = mysql_fetch_array($result) ) {

    if ($int_count == 0)$n_1 = ($row["note"]);
    if ($int_count == 4)$n_2 = ($row["note"]);
    if ($int_count == 7)$n_3 = ($row["note"]);
    if ($int_count == 12)$n_4 = ($row["note"]);
    if ($int_count == 16)$n_5 = ($row["note"]);
    if ($int_count == 19)$n_6 = ($row["note"]);
    if ($int_count == 24)$n_7 = ($row["note"]);
    if ($int_count == 28)$n_8 = ($row["note"]);
    if ($int_count == 31)$n_9 = ($row["note"]);
    if ($int_count == 36)$n_10 = ($row["note"]);
    if ($int_count == 40)$n_11 = ($row["note"]);
    if ($int_count == 43)$n_12 = ($row["note"]);
    if ($int_count == 48)$n_13 = ($row["note"]);
    if ($int_count == 52)$n_14 = ($row["note"]);

    $int_count++;   

    }

What I am trying to do is select only Major triad notes from the Major scale.

I need to be able to select a base note from a table and then select at 3 different intervals to create chords.


Update

            $result2 = mysql_query("SELECT * 
            FROM `guitar_tunings_links`
            JOIN guitar_tunings_chords ON guitar_tunings_links.".$funtion_string." = guitar_tunings_chords.note
            WHERE tuning =  '".$chrd_tn."'") or die(mysql_error());

                while ( $row = mysql_fetch_array($result2) ) {
                    $bridge_note = ($row["note_id"]);           
                }/*
                var_dump ($key_note);
                var_dump ($bridge_note);
                var_dump ($funtion_string);
                var_dump ($chrd_tn);*/
                    // SELECT * FROM `guitar_tunings_chords` WHERE `note_id` >= 28 LIMIT 0,8
                $result4 = mysql_query("SELECT * FROM `guitar_tunings_chords` WHERE `note_id` >= ".$bridge_note." LIMIT ".$tuning_capo.",8") or die(mysql_error());
                while ( $row = mysql_fetch_array($result4) ) {

                    //Notes
                    $note = ($row["note"]); 

                    // Replace # with z
                    $note = str_replace("#", "z", $note);

                    // Distinguish nut notes on or off
                    if (preg_match("/\b".$note."\b/i", $notes_array)) {
                        $n_nut_style = 'note_nut_on';
                    } else { $n_nut_style = 'note_nut_off'; 
                    }

                    // Distinguish fretboard notes on or off
                    if (preg_match("/\b".$note."\b/i", $notes_array)) {
                        $n_style = 'note_on';
                    } else { $n_style = 'note_off'; 
                    }
  • 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-05-28T03:04:45+00:00Added an answer on May 28, 2026 at 3:04 am

    You have to apply this to your exact tables but it should work pretty good.

    select * 
      from (select @i := @i+1 as count, 
                   gtc.* from guitar_tunings_chords gtc
             where note_id >= 27) counts 
      join (select @i := -1 as counter) dummy
     where count % 12 = 0 
        or (count-4) % 12 = 0 
        or (count-7) % 12 = 0;
    

    % 12 gives one complete cycle of skips, the -4 and -7 (and -0) is the internal offset within each cycle.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: MySQL returns only one row In Terminal mysql> select image,title,price from test;
I have one PHP script inserting rows in a MySQL database. Each row has
Possible Duplicate: one variable row inside another variable row I have script something like
I have a MySQL table with a number of columns, including one called 'Name'.
I have a single DB table (MySQL) which I am running a simple SELECT
Is it possible to update more than one local variable in a single select?
can i perform select single node from IXMLDOMElement ,if its possible give me one
Is it possible to use XPath to select only the nodes that have a
I have two mysql tables, one needs to start its auto-increment column id with
I have a MySQL query that goes as follows SELECT count(`clicks`.`user_id`) as total, `users`.`fullname`

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.