Jump to content

MySQL Loops


The Little Guy

Recommended Posts

- get a list of member ids

- get a sales volume of that members downline (10 levels deep)

- get everyone who has sold $100,000 in sales or more (including their downline's sales)

 

in the end, I want a temporary table that has 2 columns:

member_id and amount

 

member_id = root member id

amount = the sum of the amount of purchases that each member in his/her downline has bought (10 levels deep)

 

any thoughts?

Link to comment
https://forums.phpfreaks.com/topic/236973-mysql-loops/#findComment-1218106
Share on other sites

If I understand your objectives correctly simple SELECT's using the proper aggregate functions should answer those queries.

 

and for the temporary table you always can use VIEWS ... in other words:

- Create your VIEW with the SELECT aggregating the records in the way you want

- Use the VIEW to SELECT from it any further group of records.

 

Link to comment
https://forums.phpfreaks.com/topic/236973-mysql-loops/#findComment-1218110
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.