Could somebody comment on a better way of doing this. I have three tables...all three close to 2 Gigabytes each. and all three have the same structure.
It is taking alot of time to finish the query. Infact still not done at two hours.
I am selecting data from these three tables and doing a union of the results so my queries look like this.
Could someone tell me of a better way of doing this?
select Region_ID
,[Agency ID]
,Customer_Number
,Document_Number
,document_Date
,min(Price) From trans
Group by
,[Agency ID]
,Customer_Number
,Document_Number
,document_Date
UNION
select Region_ID
,[Agency ID]
,Customer_Number
,Document_Number
,document_Date
,min(Price) From trans
Group by
,[Agency ID]
,Customer_Number
,Document_Number
,document_Date
It is taking alot of time to finish the query. Infact still not done at two hours.
I am selecting data from these three tables and doing a union of the results so my queries look like this.
Could someone tell me of a better way of doing this?
select Region_ID
,[Agency ID]
,Customer_Number
,Document_Number
,document_Date
,min(Price) From trans
Group by
,[Agency ID]
,Customer_Number
,Document_Number
,document_Date
UNION
select Region_ID
,[Agency ID]
,Customer_Number
,Document_Number
,document_Date
,min(Price) From trans
Group by
,[Agency ID]
,Customer_Number
,Document_Number
,document_Date