Android Forums

Go Back   These FORUMS ARE DISABLED!! OUR NEW FORUMS ARE AT http://androidforum.com/ > Android Coders > Android Development, Answers, Tutorials, and Code Snippets
Connect with Facebook

Click Here To Register!
 
 
LinkBack Thread Tools Display Modes
Old 10-09-2009, 03:41 PM   #1
Junior Member
 
Join Date: Oct 2009
Posts: 5
Friends: 0
View ahisaye's Profile   View ahisaye's Photo Album   View ahisaye's Blog   View Social Groups
I need to make two left joins on two tables. My tables are basically as follows:
MAIN:
category id, product name, producer name

CATEGORY
category id, supercategoryid, name

SUPERCATEGORY
supercategoryid, name.

I need to get all the rows in MAIN along with the category name and supercategory name.

Can anyone tell me how to do this? I started with getting the main info and category info, but it only returns 5 results where the category ID is 1:

Code:
String selection = null;
Cursor peopleCursor = doSearch(MAIN_TABLE, new String[] { "category_id", "product",
		"producer" }, selection, "category_id ASC");

Cursor siCursor = doSearch(CATEGORY_TABLE, new String[] { "id", "name" },
				selection, "id ASC");

CursorJoiner joiner = new CursorJoiner(
		peopleCursor,
		new String[] { "category_id" },
		siCursor,
		new String[]
		{"id"});

MatrixCursor cursor = new MatrixCursor( new String[]
		{"name","product","producer"});
for (CursorJoiner.Result joinerResult : joiner) {
		switch (joinerResult) {
		case BOTH: 
		//prints out info here
		break;
		}
		}
Is there an easier way to do this?
ahisaye is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in Technorati
 

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Table implementation omar.salama Android Development, Answers, Tutorials, and Code Snippets 0 12-26-2008 09:03 AM
Cell phone database HCSC The Lounge 0 10-19-2008 07:39 AM
Google ask ASUS to join the Open Handset Alliance BedHead Android Chat 1 09-18-2008 03:43 AM
Sharp, Opera join the Symbian Foundation Andor The Lounge 0 09-09-2008 10:51 AM
Android and Database harshadha Android Development, Answers, Tutorials, and Code Snippets 1 05-08-2008 04:48 AM


Unlocked G1 Phones | Buy T-Mobile G1 | Google Phone

All times are GMT -6. The time now is 04:36 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.
Copyright (c) 2012 TalkAndroid.com. All rights reserved.