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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T13:54:26+00:00 2026-05-21T13:54:26+00:00

I have a query that does some magical sort-group-joining that works just fine on

  • 0

I have a query that does some magical sort-group-joining that works just fine on Android 2.2 (froyo) version of SQLite:

SELECT channels.*, p.*
FROM channels 
LEFT JOIN programs p ON channels._id = p.channel_id
JOIN (select p2.channel_id, max(p2.airdate) max_air FROM programs p2 
      GROUP BY p2.channel_id) pj
ON pj.channel_id = p.channel_id AND pj.max_air = p.airdate
ORDER BY channels.channel_index asc;

For some reason, the join doesn’t work with Android 2.1 but fails with

no such column: pj.channel_id

I reckon this is because SQLite has been upgraded from 2.1 to 2.2, but what would be the proper SQL that works for both versions?

  • 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-21T13:54:26+00:00Added an answer on May 21, 2026 at 1:54 pm

    The resolution was simple, I just needed to drop the alias “p”:

    SELECT channels.*, programs.*
    FROM channels
    LEFT JOIN programs ON channels._id = programs.channel_id
    JOIN (select p2.channel_id channel_id, max(p2.airdate) max_air FROM programs p2
          GROUP BY p2.channel_id) pj
    ON pj.channel_id = programs.channel_id AND pj.max_air = programs.airdate
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a query that does what i want joining table but i need
I have a SQL query that does some ranking, like this: SELECT RANK() OVER(PARTITION
I'm just doing a java tomcat project, that does some query in a database
Guys i have following sql query , that does some mathematical calculation and outputs
I have written a LINQ to XML query that does what I want, but
I am using in C# MYsql .I have query that works if I run
I have a query that works on Postgresql 7.4 but not on Postgresql 8.3
Here goes: I have an application that does some processing, writes some result files
i have a query that doesn't seem to be executing for some reason. I've
We have a class library that does some basic operations similar to an ORM,

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.