Hi All,
This is for knowledge and work support as well. I have two columns and I need to sort with respect to both. But the first column has priority so the second one gets sorted based on first one.
It would be great if someone could explain in detail. Thanks in advance.
Sylvan
Best practice for sort.
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 47
- Joined: Wed Apr 12, 2006 12:13 pm
Best practice for sort.
sylvan rydes
Not sure exactly what you are fishing for here. To sort in any tool based on two columns where one has 'priority' as you've called it, just mention them in the proper order:
The sort stage does something similar using the Sort Specifications property: ColumnName, SortOrder
There, an upper case SortOrder is a case insensitive sort while a lower case SortOrder is a case sensitive sort.
Code: Select all
ORDER BY COL1, COL2
Code: Select all
COL1 ASC, COL2 asc
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 47
- Joined: Wed Apr 12, 2006 12:13 pm
Hi Sylvan ,
May I know what you mean 'priority thing'?
Do you mean if a field A and B need to be sorted,
A B
1 1
1 2
1 5
2 7
2 8
2 8
2 9
Is this the order you are expeting? If so it is by default done by the DS.
If you are expecting anything else, pls specify.
May I know what you mean 'priority thing'?
Do you mean if a field A and B need to be sorted,
A B
1 1
1 2
1 5
2 7
2 8
2 8
2 9
Is this the order you are expeting? If so it is by default done by the DS.
If you are expecting anything else, pls specify.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Yah, the priority part is still a little confused. I'm assuming you just mean that for each value of COL1 you want all values of COL2 in order. And that is just achieved by declaring them in the proper order, from highest to lowest priority to use your terms.
The upper and lower-case SortOrder qualifiers in the Sort stage just tell it how to handle case when sorting... does an upper-case letter sort at the same 'priority' as a lower case letter (meaning the same letters with different case have the same weight) or are they treated differently.
Take for example the following values for COL1: c, e, A, B, D, f, G:
It's been a long day and I really hope I don't have that bass-ackwards. And that hopefully that helps.
The upper and lower-case SortOrder qualifiers in the Sort stage just tell it how to handle case when sorting... does an upper-case letter sort at the same 'priority' as a lower case letter (meaning the same letters with different case have the same weight) or are they treated differently.
Take for example the following values for COL1: c, e, A, B, D, f, G:
Code: Select all
Case sensitive (COL1 asc): A,B,D,G,c,e,f
Case insensitive (COL1 ASC): A, B, c, D, e, f, G
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers