我怎么做这个查询?

时间:2017-07-25 12:22:24

标签: mysql

我有两张桌子:

表1:

name    added_by     edited_by
a       1            3
b       2            2
c       3            1

表2:

id    login
1     admin 
2     user1 
3     user2

我需要这个结果:

name    added_by     edited_by
a       admin        user2
b       user1        user1
c       user2        admin

1 个答案:

答案 0 :(得分:2)

您可以尝试此查询

    ContentValues values = new ContentValues();
    values.put(DogEntry.NAME, "Doggy");
    values.put(DogEntry.BREED, "Dingo");
    values.put(DogEntry.GENDER, DogEntry.GENDER_MALE);
    values.put(DogEntry.WEIGHT, 15);
    Uri newUri = getContentResolver().insert(DogEntry.CONTENT_URI,values);