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

  • Home
  • SEARCH
  • 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 9129557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:46:38+00:00 2026-06-17T07:46:38+00:00

Please give me advice, what is the efficient way to select data from database

  • 0

Please give me advice, what is the efficient way to select data from database if I have query like SELECT * FROM order_list WHERE order_number = ? In table I have more entries (in my case) with common order number and I’d like to create List for entries with same order number and then shot it in ListView. I don’t know if it is efficient first select all order numbers and then in foreach loop select and create List<Item> or exists something better. I’ve tried find some example but unsuccessfully. How should I solve this problem? Thank you. I appreciate every help.

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

    You can use the same you are thinking like this:

    "select col1,col2,col3 from table   WHERE order_number = ? ", new String[]{YOUR_VARIABLE_HERE};
    

    For example:

     public Object[] getData(String Id) {
        Cursor c = null;
        ArrayList<String> arrayListProductName = new ArrayList<String>();
        ArrayList<String> arrayListProductId = new ArrayList<String>();
        db=helper.getWritableDatabase();
        c = db.rawQuery("select distinct  Column1,Column2 from Table1inner join Table2 on Table1.anyId = Table2.anyId  Table2.Id = ?", new String[]{Id});   
        c.moveToFirst();
        while(!c.isAfterLast())
        {
            arrayListProductName.add(c.getString(c.getColumnIndex("Column1")));
            arrayListProductId.add(c.getString(c.getColumnIndex("Column2 ")));
            c.moveToNext();
        }
        c.close();
        db.close();
        return new Object[]{arrayListProductName,arrayListProductId};
        }
    

    And in your Activity class:

    helper = new YourDatabaseHelper(this);
    
    Object[] objectScheme = merchandisingHelper.getData(retId);
    arrayListSchemeProductName = (ArrayList<String>) objectScheme[0];
    arrayListSchemeProductId = (ArrayList<String>) objectScheme[1];
    

    Hope this will help you.

    Thanks

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

Sidebar

Related Questions

please give me some advice. I have to send email using SQL database mail.
Can anybody give me a little advice please? I have a string, for example
Please give me some examples of jump table usage. I have seen this example
I'm new to database design, please give me advice about this. 1 When should
I have an issue with this jquery code below. Please give me advice or
Please give me some tips for this case. I have an iPhone APP which
Could someone please give me a link on how to create a query in
I just started to learn SVN. Please give me your advice to understand the
Could someone please give me some advice/ideas about how to deal with the situations
can some one please give me advice on how I make this block of

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.