Database View - One to Many relationship

k_yamamoto
Tera Expert

Hi,

I'm trying to create a database view that has a one-to-many relationship.

I have to implement this requirement because of a plugin's limitation that I will use.

 

These are tables I would like to join.

・Table A(Referenced by Table B, has multiple records of TableB)

 

・Table B (References Table A)
 Column b1(Reference field to Table A)

I would like to show these tables as below picture. (One Table A record has multiple Table B records as a related list.)

k_yamamoto_0-1679970545240.png

 

I created a database view as below.

Table A : Prefix a

Table B : Prefix b

Where clause : b_u_column_b1=a_sys_id

k_yamamoto_2-1679971555428.png

 

But it didn't work as I expected. It seems that the database view has one-to-one relationship.

k_yamamoto_1-1679971514703.png

Does anyone know how to create a database view that has one-to-many relationship?

Thanks.

6 REPLIES 6

Gopi Naik1
Kilo Sage

Hi @k_yamamoto ,

 

It was showing A0001001 record 3 times with different table B records. Try to group by number field of table A then you will see the difference. 

 

 

If my solutions helps you to resolve the issue, Please accept solution and Hit "Helpful".

Thanks,
Gopi

Hi,@Gopi Naik1 
Thank you for your reply.

Do you mean setting group by on a list view?

I would like to see that Table A record has a  3 Table B records on a form as the picture I posted first.(Like a Related Lists)

If you know any way to make it, it helps.

 

Thanks.

Hi @k_yamamoto ,

 

Do you want report to show how many B table record add to A table records or you need a related list on A table to show the B table records?

 

 

If my solutions helps you to resolve the issue, Please accept solution and Hit "Helpful".

Thanks,
Gopi

Hi, @Gopi Naik1 

I need a related list on the A table form to show the B table records.

And also, the plugin I will use requires that relationship between A table and B table be created by Database View. 
(This plugin will be used to output table data with PDF format.)