sql - Lookup value in second table -


i have 2 tables.

table data

id  item     kvartal 1   payment  1 2   salary   2 

table kvartal

id    kvartal_text kvartal_nummer 1     q1           1 2     q2           2 

i map kvartal in table data kvartal_text in table kvartal matching kvartal in table data id in table kvartal. result payment q1; salary q2.

i have tried

select * data  data.kvartal in (select kvartal.kvartal_text                         kvartal                         kvartal.kvartal_nummer = data.kvartal); 

simply join 2 tables , select fields want:

     select d.item, k.kvartal_text         data d         join kvartal k          on k.id = d.kvartal 

Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -