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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:04:49+00:00 2026-06-09T04:04:49+00:00

I have 2 tables in a SQLite file organized as follows: tNode which contains

  • 0

I have 2 tables in a SQLite file organized as follows:

  • tNode which contains a node name
  • tItem which contains a name, a priority, and the reference to its parent node. A node can have multiple items.

To list the nodes and their items, I just have to make a simple JOIN query :

SELECT tNode.node, ..., tItem.itemName, tItem.itemPriority, ...
FROM tNode
LEFT JOIN tItem ON tItem.node=tNode.node
ORDER BY tNode.node

But now I want the list of the nodes including the item regardless of its priority (without any duplicate node in the list). I thought I could use the following query:

SELECT tNode.node, ..., tItem2.itemName, tItem2.itemPriority, ...
FROM tNode
LEFT JOIN
  (SELECT itemName,itemPriority FROM tItem WHERE tItem.node=tNode.node LIMIT 1)
AS tItem2 ON tItem2.node=tNode.node
ORDER BY tNode.node

But this doesn’t work (“no such column: tNode.node”). It seems I can’t use the tNode.node column in the subquery.

How can I achieve this without having to make one subquery per column?

  • 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-09T04:04:51+00:00Added an answer on June 9, 2026 at 4:04 am

    try after removing where clause in subQuery, also LIMIT and adding group by with min

    SELECT tNode.node, ..., tItem2.itemName, tItem2.itemPriority
    FROM tNode
    LEFT JOIN
      (SELECT itemName,min(itemPriority) as min_priority FROM tItem GROUP BY tItem.node)
    AS tItem2 ON tItem2.node=tNode.node
    ORDER BY tNode.node
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a sqlite file but I don't know what tables there are in
I have two tables in a SQLite DB, and both have the following fields:
In this example we have 3 related tables on a SQLite database: CREATE TABLE
My application has multiple SQLite tables(around 20 with different fields). This I have created
I have an SQLite database. I created the tables and filled them with a
So this is what I have, I have a SQLite database with 3 tables:
I have a table in SQLite database of Android which has a column RANK
I have written an Android application that uses SQLite database which is saved in
I am creating a master database using SQLite. This single file contains a dozen
I have created tables in android sqlite using create statement and also inserted values

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.