Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
akien_ghie09
Starting Member
22 Posts |
Posted - 2012-01-24 : 03:44:38
|
Hi!I have a problem with retrieving my data. The table DeliveryAddressHistory contains millions of records. I'm retrieving the data but it takes time to display the result. How can I make it faster. This is my code:SELECT restaurant_master.name, RegionMaster.RegionName AS 'region', CityMaster.CityName AS 'city', DeliveryAddressHistory.Area, DeliveryAddressHistory.Street, DeliveryAddressHistory.Building, COUNT(mds_orders.OrderDate) AS 'totalorders', SUM(mds_orders.GrossTotal) AS 'totalgross'FROM mds_ordersJOIN DeliveryAddressHistoryON mds_orders.PKID = DeliveryAddressHistory.OrderFKIDJOIN CityMasterON DeliveryAddressHistory.CityFKID = CityMaster.PKIDJOIN RegionMasterON CityMaster.RegionFKID = RegionMaster.PKIDJOIN restaurant_masterON mds_orders.RestaurantID = restaurant_master.PKIDWHERE mds_orders.OrderDate BETWEEN '".$date_from." 00:00:00' AND '".$date_to." 23:59:59'GROUP BY restaurant_master.name, RegionMaster.RegionName, CityMaster.CityName, DeliveryAddressHistory.Area, DeliveryAddressHistory.Street, DeliveryAddressHistory.Building, mds_orders.StatusFKIDAny suggestion/advice will be appreciated.Best regards! AkiEn009 |
|
|
biswajitdas
Starting Member
44 Posts |
Posted - 2012-01-24 : 15:09:31
|
| you said , display , where you display the records . due to use the sql report or due you are using any application like asp.net or vb.entSr Sql server DBA/Artitech |
 |
|
|
akien_ghie09
Starting Member
22 Posts |
Posted - 2012-01-24 : 20:12:51
|
| i'm doing a PHP file where you can get the result and export it in csv file, but it takes way too long to display.What I must do?AkiEn009 |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
akien_ghie09
Starting Member
22 Posts |
Posted - 2012-01-24 : 20:45:18
|
| okay. thanks you so much.AkiEn009 |
 |
|
|
|
|
|
|
|