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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:40:16+00:00 2026-06-15T03:40:16+00:00

I have a table people id name —-+—– 54 Tango 76 Alpha 95 Radio

  • 0

I have a table people

id    name
----+-----
54    Tango
76    Alpha
95    Radio

When displaying the records on the web those names are ordered alphabetically

Alpha, Radio, Tango

Lets say we’re viewing Radio details and want to navigate to the next (Tango) or prevoius (Alpha) record using some links.

How can I find those id's to create the needed links?

Finding next superior or inferior id won’t work.

Is this possible?

Thanks.

  • 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-15T03:40:17+00:00Added an answer on June 15, 2026 at 3:40 am

    You can do this:

    SELECT name
    FROM
    (
       SELECT name, (@rownum := @rownum + 1) rank
       FROM people, (SELECT @rownum := 0) t
       ORDER BY name
    ) t WHERE rank = @n
    

    You should use the new ranking number column rank to create those links. Then you should control the value of the parameter @n to get the previous or the next.

    SQL Fiddle Demo

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

Sidebar

Related Questions

Simple and fast question, i have those tables: //table people | pe_id | pe_name
I have a database table, with people identified by a name, a job and
I have a table people (name, address, phone), my table have 2000+ rows. I
I have this sql table with people's name and ages. Bob 28 Bryan 30
So I have a table people which is like this Id Name 1 John
I have 3 tables: CREATE TABLE Names ( Name TEXT(20) NOT NULL, Gender TEXT(20)
Lets just say I have a table with people's name and their birthday (date
I have two tables, like these: Table People: VARCHAR Name INTEGER Age Table Message
I have a table where two people may have the same name, but separate
I have a table which called people, and I have there 2 columns, name

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.