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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:31:42+00:00 2026-06-04T09:31:42+00:00

Is it possible to retrieve multiple paths from MySQL nested sets? Emphasis is on

  • 0

Is it possible to retrieve multiple paths from MySQL nested sets? Emphasis is on the second line of the where condition.

SELECT parent.name
FROM nested_category AS node,
    nested_category AS parent
WHERE node.lft BETWEEN parent.lft AND parent.rgt
    AND node.name = 'Name1' OR node.name = 'Name2'
ORDER BY node.lft;
  • 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-04T09:31:44+00:00Added an answer on June 4, 2026 at 9:31 am

    Yes, of course.

    In SQL, OR has lower precedence than AND, so you need to rewrite the query as:

    SELECT  parent.name
    FROM    nested_category AS node
    JOIN    nested_category AS parent
    ON      node.lft BETWEEN parent.lft AND parent.rgt
    WHERE   node.name IN ('Name1', 'Name2')
    ORDER BY
            node.lft;
    

    This query is quite inefficient in MySQL because the join condition is not sargable.

    You may want to store your sets as LineString and use spatial indexes to speed up the query.

    See this entry in my blogs for details:

    • Adjacency list vs. nested sets: MySQL
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to retrieve data from multiple tables in a LINQ-to-sql database to
is it possible to retrieve by using connection.getschema() the description item from a sql
Hi i am currently retrieving multiple images from isolated storage. When i retrieve the
I'm just wondering..is it possible to receive multiple responses from a single ajax call?
In SQL Reporting Services, is it possible to retrieve a certain value from a
is it possible to retrieve statistics about the minimal or maximal value of a
Is it possible to retrieve programmatically all the case of a switch ? I
If it possible to retrieve camera pic in background and save the pic every
Hi (sorry for my ugly english) I wonder if this is possible to retrieve
Is it possible to make JavaScript retrieve a file that is above the web

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.