Forum Discussion

SeanCarpenter's avatar
SeanCarpenter
Qrew Member
2 years ago

Self-join for "Sibling" Rows

I have two tables that represent a parent-child relationship. Each row in the child table contains a "parent_id" column that relates it to the parent table. I'd like to create a report that (for a specific child) shows other rows that have the same "parent_id".

I thought that I would create a self-join relationship on the child table but I can only do that using the child table's key field. I'd like to do it on "parent_id" instead. Is there a different pattern I can use to show these "sibling" rows (rows with the same "parent_id")?



------------------------------
Sean Carpenter
------------------------------
  • If you simply want to show a report on each child record to show its siblings, then this is very easy.

    child record to show its siblings, then this is very easy.

    Just create a Report Link Field.  That does not need a relationship. Although when you make a relationship, it generates a report Lingfield for your convenience. You can simply make a report Lakefield whatever you need one.

    That does not need a relationship. Although when you make a relationship, it generates a report Linkfield for your convenience. You can simply make the report Lakefield whatever you need one.

    Simply cainfigure the field properties on the report link field to match up the parent ID from the child records table and then on the right side navigate to your app and then the same field on the child table for parent ID. 


    Then put the report Lakefield on the form, select the radio button on the form to show the records directly on the form on a report and point the form to inappropriate report, which has the columns and thought that you want.

    then put the report Lakefield on the form, select the radio button on the form to show the records directly on the form on a report and point the form to an appropriate report, which has the columns and forward that you want.

    Note that the report link field will also include the record child record you are viewing. There's no real way around that. 



    ------------------------------
    Mark Shnier (Your Quickbase Coach)
    mark.shnier@gmail.com
    ------------------------------

  • If you simply want to show a report on each child record to show its siblings, then this is very easy.

    child record to show its siblings, then this is very easy.

    Just create a Report Link Field.  That does not need a relationship. Although when you make a relationship, it generates a report Lingfield for your convenience. You can simply make a report Lakefield whatever you need one.

    That does not need a relationship. Although when you make a relationship, it generates a report Linkfield for your convenience. You can simply make the report Lakefield whatever you need one.

    Simply cainfigure the field properties on the report link field to match up the parent ID from the child records table and then on the right side navigate to your app and then the same field on the child table for parent ID. 


    Then put the report Lakefield on the form, select the radio button on the form to show the records directly on the form on a report and point the form to inappropriate report, which has the columns and thought that you want.

    then put the report Lakefield on the form, select the radio button on the form to show the records directly on the form on a report and point the form to an appropriate report, which has the columns and forward that you want.

    Note that the report link field will also include the record child record you are viewing. There's no real way around that. 



    ------------------------------
    Mark Shnier (Your Quickbase Coach)
    mark.shnier@gmail.com
    ------------------------------

    • ChayceDuncan's avatar
      ChayceDuncan
      Qrew Captain

      If you need something to be able to report more generically beyond what Mark said, you can also make a formula query that grabs something like a CHILD_ID or SIBLING_NAME that you can search for similar items in your table with the same parent id but not equal to the current record id, that way you could have a table report that shows a list of your child records across many parent IDs and still be able to conceptualize their siblings in addition to what Mark suggested with the report link and seeing them on the form. 



      ------------------------------
      Chayce Duncan
      ------------------------------