My first try at using Redshift. Trying to use ORDER BY and not getting the expected result. The output table should be sorted by column "a".
Here are the steps:
1. Create tbl_data
SELECT 3 as "a", 30 as "b" UNION ALL SELECT 3 as "a", 30 as "b" UNION ALL SELECT 2 as "a", 20 as "b" UNION ALL SELECT 2 as "a", 20 as "b" UNION ALL SELECT 1 as "a", 10 as "b" UNION ALL SELECT 1 as "a", 10 as "b"
2. Order and output as pd_a1
SELECT * FROM "tbl_data" ORDER BY "a"
Here is the result:
Thanks for your attention.
This has to be a bug. I am having the same issue that @BruceP is having with the order by clause.
Have you submitted a ticket yet?
I wrote a simple query to order by closedate and got some strange but consistent results. I tried to dig into the database details of how this is being sorted, like sortkey and distkey, but didn't really know what i was doing, and creating a temp table and applying the sortkey/distkey using custom sql didn't seem to make a difference. Any ideas?