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.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Pivot Query For Bulk Datas from different Table

Author  Topic 

Kalaiselvan
Posting Yak Master

112 Posts

Posted - 2011-01-26 : 14:21:23
Hi,
Table A : 300000 Records (Branch,Division,Centre and Some Financial details with Members columns)
Table B : 300000 Records (Branch,Division,Centre and Some Financial details with Members columns)
Table C : 300000 Records (Branch,Division,Centre and Some Financial details with Members columns)
Table D : 18000000 Records (Branch,Division,Centre and Some Financial details with Members and Date columns)

Here Table D is a child table for Table A,B and C. Which got records with Date column.

Here i need to build a query and need to take the reports. Now i have made a simple query with some joins for these tables and Grouping for Branch names.

Select Column 1,
Column 2,
Column 3,
Column 4,
Column 5,
SUM(Column 6+Column 7)-SUM(Column 8),
SUM(Column 9)/Column 10,
SUM(Column 11)
FROM
Table A INNER JOIN Table B
INNER JOIN Table C
INNER JOIN Table D
WHERE Some Conditions....

To run this Query it takes nearly 30 mins bcoz of Bulk records.

Please help me in this to Make Query fast or to convert it into Pivot Query. Reply anyone ASAP.. (If you need the complete query with Table name and Columns with exact conditions will sent it).

Regards,
Kalaiselvan R
Love Yourself First....
   

- Advertisement -