Domanda

I am trying to build a web application that enables users to refer people to the site. A user can refer up to 10 people to the site and can have up to 7 generations, meaning that each person referred to the system by a referred user will be related to the immediate referrer and the other user that referred the newly registered user’s referrer, up to the seventh level.

The diagram below will help give a view of what I mean.

enter image description here

I'm using SQL Server 2008 for my database.

È stato utile?

Soluzione

This is impossible to answer in general because the answer depends on what kind of queries you plan to run against your data.

But there are many alternatives for how to store hierarchical data in a database. You can start with Implementing a hierarchical data structure in a database.

If that's not enough, Google is your friend

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top