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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:12:01+00:00 2026-05-26T04:12:01+00:00

I got two tables links and categories how do i get 4 colunms from

  • 0

I got two tables “links” and “categories” how do i get 4 colunms from links and one from categories?

**Links**
_id
link_title
link_desc
link_date

**Categories**
_id
cat_title
cat_desc

i need a single row like this
_id, link_title, link_desc, link_date, cat_title

and then use this in my cursor

private void fillData() {
    Cursor linkCursor = mDbHelper.fetchAllLinks();
    startManagingCursor(linksCursor);

    String[] from = new String[]{ DbAdapter.LINK_TITLE, DbAdapter.LINK_DESC, DbAdapter.LINK_DATE, DbAdapter.LINK_ROWID, DbAdapter.CAT_DESC };
    int[] to = new int[]{ R.id.title, R.id.content, R.id.date, R.id.headid, R.id.catdesc  };

    SimpleCursorAdapter links = new SimpleCursorAdapter(this, R.layout.linkrow, linkCursor, from, to);
    //links.setViewBinder(new MyViewBinder());
    setListAdapter(links);
}

I tried SQL UNION but it dont worked.

  • 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-26T04:12:02+00:00Added an answer on May 26, 2026 at 4:12 am

    What you want is called a join. But to do this you need to either give two ids, or add a category_id column to the Links-table.

    SELECT
        l._id,
        link_title, 
        link_desc,
        link_date, 
        cat_title
    FROM Links l,  Categories c
    WHERE l._id = ?
    AND c._id = ?
    

    or after adding the column

    SELECT
        l._id,
        link_title, 
        link_desc,
        link_date, 
        cat_title
    FROM Links l
    LEFT JOIN Categories c ON c._id = l.link_cat_id
    WHERE l._id = ?
    

    More information:

    • w3schools.com/sql – Tutorial about SQL. Generic SQL which works for most database engines.
    • sqlite.com/lang.html – Syntax reference for SQLite, which is used in Android.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got two tables. One is Corporations (e.g., one record is for Taco Bell).
I got two tables. One that holds all availeble trophys and one that holds
I've got two tables, one holds reservations for a room, and the other is
I got two tables Product(Productname VARCHAR(10), Rating REAL) and Review(RatingID INT, Productname VARCHAR(10), Rating
I got two tables in my database: user and call. User exists of 3
I've got two tables in my database: Articles and Tags The Tags tables consist
I've got two tables: TableA ------ ID, Name TableB ------ ID, SomeColumn, TableA_ID (FK
I've got two tables that need to be joined via LINQ, but they live
i've got two tables: members and members_data . They both share the same unique
I've got two tables. Invoice with columns CustomerID, InvoiceDate, Value, InvoiceTypeID (CustomerID and InvoiceDate

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.