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 9044985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:07:56+00:00 2026-06-16T11:07:56+00:00

I was wondering if this is possible to make MySQL do a double search;

  • 0

I was wondering if this is possible to make MySQL do a “double search”; I don’t really know how to say it well so here’s an example:

I have a table of songs information (title,album, etc etc …). I want to get the next song in the album. I have the ID of the current song. Currently I get the row, check the album and track field, then do another MySQL query based on album field and check if there is another track after the current one.

Could I, in one query, tell MySQL that I want all rows of the album contained in the row of the id I have?

Since I really don’t know if this is possible or how to describe it, I didn’t find anything useful on Stack Overflow, so sorry if there is already something similar.

  • 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-16T11:07:57+00:00Added an answer on June 16, 2026 at 11:07 am

    You could use a JOIN to get what you want. Assuming your table has an ID that links to an album something like this would work to get everything that comes after the track currently being listened to.

    select *
      from songs a
      join songs b
        on a.album_id = b.album_id
     where a.song_id = 1 
       and b.song_id > a.song_id
    

    Obviously, if you want everything in the album then remove the second condition. If you want to include the track being listened to change > to >=.


    You’ve just commented:

    i should have mentionned it but the id is not relevant to the order of
    tracks , it’s juste the primary key in the table.

    If this is the case then then b.song_id > a.song_id is probably incorrect. You haven’t given us your full schema but I would highly recommend if your songs table contained the order the tracks should be played in, so it would look something like (SONG_ID, ALBUM_ID, ALBUM_ORDER, ... more song level info ). Your query would then become:

    select *
      from songs a
      join songs b
        on a.album_id = b.album_id
     where a.song_id = 1 
       and b.album_order > a.album_order
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm wondering about this possibility. Is it possible to make our code written in
I was wondering if this was possible... I have a sequence of variables that
I know this is possible in Perl, but I was wondering if this can
I'll try and make this question as brief as possible. I was wondering if
I was just wondering if this is possible. I have a site that admins
I was wondering if this is possible in pure CSS. Suppose you have an
Just wondering if this is possible or not: Say I've got a TabContainer with
Wondering if this is possible. We have an 3rd Party library that contains identification
I was wondering if this was possible? I'm not familiar with using windows command
I was wondering if this was possible, and if so how I'd go about

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.