Save data in relational table in content provider by inner join

How you can see in image i have a TABLE A, TABLE C e an array list A.

I need to create a relational table (Table B) that have id of Table A (id_A) and id of Table C (id_C). The array list have every id's of table C that I need. So i need a way to save data of table B where 1 id_A respect to N elements of id_C.

I know that i can do with inner joins, but i don't know how start this in content provider. Anyone can give a help, or a example?

Thanks or your time

Answers


I'm wrong about this point. Inner join serves to make query to database, not to create one table that result of two other.

Here is my solution to do what i pretend, using foreign key's

      private static final String DATABASE_SOCIO_QUOTA = " CREATE TABLE IF NOT EXISTS  "
        + SocioQuota.TABLE_NAME + " ( "
        + SocioQuota.C_ID + " INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "
        + SocioQuota.C_VALOR + " DOUBLE NOT NULL, "
        + SocioQuota.C_ESTADO + " INTEGER NOT NULL, "
        + SocioQuota.C_SOCIO_ID + " INTEGER NOT NULL, "
        + SocioQuota.C_SESSAO_QUOTA_ID + " INTEGER NOT NULL, "
        + " FOREIGN KEY( " + SocioQuota.C_SOCIO_ID + " ) REFERENCES " +              Table_A + " ( " + Socio.C_ID + " ) "
        + " FOREIGN KEY( " + SocioQuota.C_SESSAO_QUOTA_ID + " ) REFERENCES " + Table_C + " ( " +SessaoQuota.C_ID + " ) "
        + " ) ";

and then save the value for each column of this table


Need Your Help

Convert Query Builder query to Eloquent ORM

mysql laravel laravel-4 orm laravel-5

I want to convert my current query to ORM. But, I cant understand clearly how to join.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.