zaster

Table Structure Issue - Many to Many

Posted 1 month ago by zaster

dispatches 1------M dispatch_items

sub_jobs 1-------M dispatch_items

dispatches M-----N sub_jobs

I need to have all of these relationships

dispatch_subjob table (Is the intermediary table between dispatches and sub_jobs) and it has below mentioned columns

id
dispatch_id
sub_job_id

dispatch_items tablehas below mentioned columns

id
dispatch_id
sub_job_id
qty
description

My issue is that i see dispatch_id and sub_job_id is repeated in both tables(Table structure looks wrong)

Practically i need to have both of these tables like above mentioned to get results in a much practical way

E.g.: - sub_jobs table has a qty field and i need to do some caculations with dispatch_items table qty (Use of 1 to M)

E.g.:- I need to get all sub_jobs of when a dispatch_id is given (Use of M to M)

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.