mysql - Select column called Titel where the id is the same from another Table -


let's call table person:

+------+----------+-----------------+------------+-------------+---------------+ | id   | lastname | firstname       | created_at | updated_at | discriminator  | +------+----------+-----------------+------------+------------+----------------+ |  52  | bach     | johann sebastian| 21732312312|   666666666| komponist      |    125 | beethoven| ludwig van      | 74197212821| 44444444444| komponist      |    84  | mozart   | wolfgang        | 57128371293| 33333333333| komponist      |    241 | rossini  | gioacchino      | 97128371832| 77777777777| komponist      |    1   | david    | beckham         | 97128371832| 77777777777| member         |    2   | messi    | lionel          | 97128371832| 77777777777| member         |    3   | ronaldo  | christiano      | 97128371832| 77777777777| member         | +------+----------+-----------------+------------+------------+----------------+ 

and table creation:

    +----+----------+---------------+------+     | id | personid |    titel      | name |     +----+----------+---------------+------+     |  1 | 52       | klavierkonzert| non  |     |  2 | 125      | ballade et    | non  |     |  3 | 84       | magnificat    | non  |     |  4 | 241      | overtuer      | non  |     |  5 | 1        | solo          | non  |     |  6 | 2        | homemade      | non  |     |  7 | 3        | random        | non  |     +----+----------+---------------+------+ 

i pretty new mysql , databases please patience.

how select titel column in table creation, id in person equals personid in creation , discriminator should komponist? no titels members.

do need multiple statements this?

select t1.titel creation t1 inner join person t2   on t1.personid=t2.id t2.discriminator='komponist' 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -