Combine or join two different table to a view

Hi,

I am trying to create a view out of table A and B by combining them . both tables doesn't have any common columns except created date and created by . 

 

I would like to combine both these tables . can you please is it possible in Appian MySql ?

Table A

 

Fruit_ID

Fruit

Created Date

Created By

1

Apple

12/19/2018

John

2

Orange

12/19/2018

John

 

 

Table B

 

Veg_ID

Vegetables

Created Date

Created By

12

Carrot

1/23/2019

Mark

23

Zucchini

1/23/2018

Mark

 

 

 

Output View

 

Fruit_ID

Veg_ID

Fruit

Vegetables

Created Date

Created By

1

NULL

Apple

NULL

12/19/2018

John

2

NULL

Orange

NULL

12/19/2018

John

NULL

12

NULL

Carrot

1/23/2019

Mark

NULL

23

NULL

Carrot

1/23/2018

Mark

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer
    I am unsure of the use case here, and believe you likely should design a single table for Food, which holds both vegetables and fruits, and has a type column.

    Additionally, this would be solved purely in MySQL.

    I would suggest looking into UNION ALL MySQL functionality. Since your tables do not have the same column names, you'll have to fake it by Selecting NULL for Table B's unique columns in Table A's select statement and vice versa.

    dev.mysql.com/.../union.html
Reply
  • 0
    Certified Lead Developer
    I am unsure of the use case here, and believe you likely should design a single table for Food, which holds both vegetables and fruits, and has a type column.

    Additionally, this would be solved purely in MySQL.

    I would suggest looking into UNION ALL MySQL functionality. Since your tables do not have the same column names, you'll have to fake it by Selecting NULL for Table B's unique columns in Table A's select statement and vice versa.

    dev.mysql.com/.../union.html
Children