Hey everyone,
Wasn't sure where to put this question, so I figured this topic may suit it the best.
Here's the situation: I have a table (table x) with fields name, phone, recnum, product, etc etc etc. recnum is PK (autonumber, etc) in this table.
hmm ... on second thought, here's a visual of "sample data" that this table may contain:
So, as you can see above, name / phone / product may be duplicated in records.
What I am looking to do with the above is have each name / phone combination display on screen, and then all the products / other fields listed underneath, such as this:
What I am doing right now is this:
1) Using a "SELECT DISTINCT ..." statement, I am pulling a distinct set of records from the database containing ONLY a unique name and phone number combination.
2) I am populating a Treeview control with this data as the parent nodes in the tree.
3) I am then running another SELECT statement against the same table to pull all the product transactions from it, and am posting those as child nodes to the parent nodes above.
However, we are upgrading all of our databases to SQL Server (above was an Access platform), and are also moving the front ends to a web-based solution (don't ask ... long story), and I don't think that the above solution I am using is the fastest method of retrieving data.
Soooo .... I guess what I'm really asking is this: Can anyone suggest a faster method for retrieving this data? Or, even better, how about an alternative method that doesn't use a Treeview control, but maybe a constructed Tree structure in say ASP or PHP?
Thanks,
Greg
Wasn't sure where to put this question, so I figured this topic may suit it the best.
Here's the situation: I have a table (table x) with fields name, phone, recnum, product, etc etc etc. recnum is PK (autonumber, etc) in this table.
hmm ... on second thought, here's a visual of "sample data" that this table may contain:
Code:
name phone product recnum
bob 1234567 Acme-X 4
bob 1234567 Acme-Y 51
bill 1239876 Acme-Z 120
bob 1234567 Jelly Beans 8
So, as you can see above, name / phone / product may be duplicated in records.
What I am looking to do with the above is have each name / phone combination display on screen, and then all the products / other fields listed underneath, such as this:
Code:
bob 1234567
- Acme-X
- Acme-Y
- Jelly Beans
bill 1239876
- Acme-Z
What I am doing right now is this:
1) Using a "SELECT DISTINCT ..." statement, I am pulling a distinct set of records from the database containing ONLY a unique name and phone number combination.
2) I am populating a Treeview control with this data as the parent nodes in the tree.
3) I am then running another SELECT statement against the same table to pull all the product transactions from it, and am posting those as child nodes to the parent nodes above.
However, we are upgrading all of our databases to SQL Server (above was an Access platform), and are also moving the front ends to a web-based solution (don't ask ... long story), and I don't think that the above solution I am using is the fastest method of retrieving data.
Soooo .... I guess what I'm really asking is this: Can anyone suggest a faster method for retrieving this data? Or, even better, how about an alternative method that doesn't use a Treeview control, but maybe a constructed Tree structure in say ASP or PHP?
Thanks,
Greg