mardi 20 octobre 2015

Is there a way to combine (JOIN) data from 2 tables together with SQLite?

I tried a few things to combine 2 tables, but the results returns only the data from the first table.

This are my tables:

 [Table("Person")]
public class Person
{
    [PrimaryKey, AutoIncrement]
    public int PersonID { get; set; }
    public string Name { get; set; }
    public int CompanyID { get; set; }
}

 [Table("Company")]
public class Company
{
    [PrimaryKey, AutoIncrement]
    public int CompanyID { get; set; }
    public string Name { get; set; }
}

And this is my query:

 var result = await _Connection.QueryAsync<Person>("SELECT * FROM Person JOIN Company ON Person.CompanyID = Company.CompanyID");

        return result;

But it only gives the properties from the first table "Person". What did i forgot?

Aucun commentaire:

Enregistrer un commentaire