Am want to sort my data while loading it in the script.
I am importing the data from a qvd and I have read on the internet that data can be sorted using order by only if it is resident in anothet table.
Therefore I am importing the qvd in a table called TEMP and then I am using this TEMP table as a Resident table for my data.
The TEMP is used as a resident table for my new table POC_TABLE (which I want to have the data sorted by declaration date) and POC_DAILY_SALES where I calculate some aggregations.
The issue is that when I drop the TEMP the only existing data that I have after running the below script is the data existing in POC_DAILY_SALES and nothin from POC_TABLE.
How can I obtain the POC_TABLE data ordered by date and also the information from POC_DAILY_SALES?
SET TimeFormat='h:mm:ss TT';
SET TimestampFormat='M/D/YYYY h:mm:ss[.fff] TT';
POC.DECLARATION_DATE as DECLARATION_DATE,
POC.DECLARATION_DATE-1 as DECLARATION_DATE_prev,
POC.ACTIVE_FOR_AVA as ACTIVE_FOR_AVA,
POC.FLAG_FOR_NDR as FLAG_FOR_NDR,
POC.POC_CODE as POC_CODE,
[C:\#01 - Backup QVD\QVD\AVA\AVOPS_POCS_201301PLA005.QVD]
where POC.DECLARATION_DATE='31/01/2013' or POC.DECLARATION_DATE='24/01/2013' ;
order by DECLARATION_DATE;
SUM(POC.QTY_OUT) AS Sum_Per_POC,
sum(POC.CURRENT_WEEK_OUT) as Sum_Per_POC_CurrentWeek,
sum(POC.PREVIOUS_WEEK_OUT) as Sum_Per_POC_PreviousWeek
group by POC_CODE, DECLARATION_DATE,ACTIVE_FOR_AVA,_KEY_Family;
drop table TEMP;