Parent-Child with 1:many

kkemeraitkkemerait Posts: 7
edited January 19, 2017 3:50AM in SQL Data Generator
I have a parent table (client) and a child table (Jobsites) I need to generate Jobsite rows so that I have a minimum of 1 row in Jobsite for every PK in client, but I want some Clients to have more than a single child row. The problem is that I can get the multiple rows in the child table but when I do so, I do not ALWAYS have at least one row for each parent. For example

Client:
ID
100
101
102
103

JobSite
ID Client_ID
1 100
2 102
3 102
4 102
5 103
6 103

As you can see I have no child row in the Jobsite table which corresponds to client row with ID 101
The way it should be is this

JobSite
ID Client_ID
1 100
2 101
3 101
4 102
5 102
6 102
7 103
8 103

So I have at least one child row for each parent row and some parent rows have multiple child rows.

Comments

  • Eddie DEddie D Posts: 1,802 Rose Gold 5
    Hi, thank you for your forum post.

    A support ticket has been created for you, the call reference is #81155, which can be accessed via the Redgate Support Portal (which requires a Redgate ID). Alternatively, send an email to support@red-gate.com quoting Call Reference #81155 and please provide the following so we can help you:

    DDL for both the parent (Client) and child (Jobsites) for us to test against.
    What type of generator are you using, or are you custom generator?

    Many Thanks
    Eddie
    Eddie Davis
    Senior Product Support Engineer
    Redgate Software Ltd
    Email: support@red-gate.com
Sign In or Register to comment.