Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 7,2000
»
SQL Server Newbies
»
Order by for Ratio Dataset
Order by for Ratio Dataset
Rate Topic
Display Mode
Topic Options
Author
Message
akilamm
akilamm
Posted Thursday, September 03, 2009 7:10 AM
Grasshopper
Group: General Forum Members
Last Login: Tuesday, May 11, 2010 11:50 PM
Points: 15,
Visits: 46
Hi
i am trying to arrange ratio dataset in ascending order
example dataset looks like this
50302136 120:0:7:4
50303835 194:0:9:6
50302786 249:0:14:7
50302640 37:0:2:0
50303753 382:0:7:1
50302137 59:0:10:0
i tried with order by ,it is not working
is there any solution to arrange data in ascending order
Post #782130
Steve Jones - SSC Editor
Steve Jones - SSC Editor
Posted Thursday, September 03, 2009 9:09 AM
SSC-Dedicated
Group: Administrators
Last Login: Yesterday @ 3:26 PM
Points: 31,425,
Visits: 13,738
I'm not sure what I'm looking at here. What are the data types? Is the ratio a char field? If so, then it is ordered as characters.
What ordering are you trying to get, or what are the rules for ordering your ratios?
Follow me on Twitter:
@way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
Post #782277
akilamm
akilamm
Posted Thursday, September 03, 2009 9:22 AM
Grasshopper
Group: General Forum Members
Last Login: Tuesday, May 11, 2010 11:50 PM
Points: 15,
Visits: 46
hi
i am having ratio values as output from proc for example (20:2:1)
i want arrange this values in ascending order or in descending order
Post #782288
Steve Jones - SSC Editor
Steve Jones - SSC Editor
Posted Thursday, September 03, 2009 9:30 AM
SSC-Dedicated
Group: Administrators
Last Login: Yesterday @ 3:26 PM
Points: 31,425,
Visits: 13,738
These have to be coming back as characters. Therefore they'll be ordered as characters.
20:1:1
comes before
20:2:5
No matter what the math, these are ordered by characters. If you have some rules, you could use charindex and substring to strip out the individual numbers and possibly find a way to order them, but the rules for reducing these to the lowest values would be complex.
Again, if you develop the rules that you need for ordering these, we might be able to help.
Follow me on Twitter:
@way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
Post #782298
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.