Saturday, 28 September 2013

How To Grouping And Then Sorting Query SQL Server 2000 From Different Database Using PHP

How To Grouping And Then Sorting Query SQL Server 2000 From Different
Database Using PHP

I had a case like this. there are several branches database. I already can
create a report using PHP that show name product, total sales, then grand
total for all name product.
Now i want create a report for all branches database. How to do it? I want
create a report like this, The report must be group by each name product
from all branches. And then for each name product, display its, total
sales on the right side. Finally at the bottom of report, display grand
total for all name product group.
The method i have research and try to do this (but i still fail get a report)
First i create query to display top 20 name product from all branches
database. for example i have 10 branches database. By doing this i get
20*10 = 200 name product that already group by name product. Sorted DESC
by its total sales.
I created temp database to save this result temporary to group it again
and sorting DESC to get 20 name product. The problem is, i fail to create
temp database, if this method right, please guide me to create temp
database using php on sql server 2000.
OR
First i create query to display top 20 name product from all branches
database. for example i have 10 branches database. By doing this i get
20*10 = 200 name product that already group by name product. Sorted DESC
by its total sales.
I created an single array to save this result temporary to group it again
and sorting DESC to get 20 name product. The problem is, how to create
array and then grouping its value and sorting it? Please guide me, if this
method is the best way to create a report for my case.
Lastly, Please forgive me if my english bad. I'll appreciate to hear a
suggestion from all of you out there.
Thanks and best regards.

No comments:

Post a Comment