dimanche 28 juin 2015

Writing a query to display the following result?

There are 3 tables

Table A:
code        aname
------- ----------
1           A
2           B
3           C


Table B:
code        bname
----------- ----------
1           aaa
1           bbb
2           ccc
2           ddd


Table C
code        cname
----------- ----------
1           xxx
1           yyy
1           zzz
2           www

We need to write a query that would display the following result.

code        aname      bname            cname
----------- ---------- ----------      ----------
1                  A    aaa              xxx
1                  A    bbb              yyy
1                  A    NULL             zzz
2                  B    ccc              www
2                  B    ddd              NULL
3                  C    NULL             NULL

Aucun commentaire:

Enregistrer un commentaire