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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:24:09+00:00 2026-05-18T05:24:09+00:00

From my main.java: Cursor c = db.getDue(); String[] columns = new String[] { _id,

  • 0

From my main.java:

    Cursor c = db.getDue();

    String[] columns = new String[] { "_id", "date" };  

    int[] to = new int[] { R.id.num, R.id.date };

    SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(this,
            R.layout.lventer, c, columns, to);
    ListView lv1 = (ListView)findViewById(R.id.ListView01);

    lv1.setAdapter(mAdapter);

From my database wrapper class:

    public Cursor getDue() {
    //String getdue = "SELECT * FROM tb1"; // this returns _id+date and displays them in the listview via the cursor adapter, defined above
    String getdue = "SELECT _id, max(date) AS date FROM tb1 GROUP BY _id";// this only works if I remove the "date" bindings defined above, only letting me see the _id, i want to see both _id and date in the lit view.

    return db.rawQuery(getdue,null);

If I use the second select statment then it crashes unless I remove the “date” from the cursor adapter/listview bindings, if I do this then It will show the returned _id in the listview, but I want to see both _id and date in the listview.

I have been told that the second statment might returns a different type for date because of the max function ( I am not very sql literate, yet), but I thought that sqlite was loose with datatypes? Can anybody help, thanks in advance.

** UPDATE** This is the command that wont work with 2 columns fr the list view:

 SELECT _id, max(date) FROM jobs GROUP BY _id HAVING max(date) < (date-21)
  • 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-18T05:24:10+00:00Added an answer on May 18, 2026 at 5:24 am

    Use this:

    String getdue = "SELECT _id, max(date) AS date FROM tb1 GROUP BY _id";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got my brand new VS2008 and decided to convert my main solution from
Can I query from 2 tables like this? public Cursor getSen_List(long id_thsen ) {
My goal is to maintain a web file server separately from my main ASP.NET
I am building a relatively simple Django application and apart from the main page
I have just branched our Common Business Layer projects from the main to a
Given a System.Timers.Timer, is there a way from the main thread to tell if
I understand the main function of the lock key word from MSDN lock Statement
I have a main window (#1) on my webpage from which I open a
I have a main table that I must get data from. I have a
how can i pass values from my custom components back to the main.mxml? i

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.