I have some data I need sorted and then count the sequence and then load into a table. Here is my process order that isn't working:
DROP TABLE temp;
CREATE TABLE temp
INSERT INTO temp
SELECT
a,
b,
c,
d,
CSUM(1,1) as SEQ_count
...
GROUP BY a, b, c
ORDER BY a, b, c, d desc
It tells me I can't use ORDER BY in a Sub query. I have to prioritize my data (which is not in any good order) and set it to a value to Rotate at a later date by priority:
ie a, b, c, dpriority1, dpriority2, dpriority3
Is there another way to do different sorts depending on which column i want to prioritize or if i want to prioritize more than 1 column. Can I set a default order by on the CREATE TABLE and then do the CSUM(1,1) after data is inserted?
Thanks in advance!!
Jon
DROP TABLE temp;
CREATE TABLE temp
INSERT INTO temp
SELECT
a,
b,
c,
d,
CSUM(1,1) as SEQ_count
...
GROUP BY a, b, c
ORDER BY a, b, c, d desc
It tells me I can't use ORDER BY in a Sub query. I have to prioritize my data (which is not in any good order) and set it to a value to Rotate at a later date by priority:
ie a, b, c, dpriority1, dpriority2, dpriority3
Is there another way to do different sorts depending on which column i want to prioritize or if i want to prioritize more than 1 column. Can I set a default order by on the CREATE TABLE and then do the CSUM(1,1) after data is inserted?
Thanks in advance!!
Jon