By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,362 Members | 1,354 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,362 IT Pros & Developers. It's quick & easy.

shorting problem in query

P: 52
i have a problem in a query like


select field1, field2
from table1
order by field1 field1 contains countries (varchar2)


the problem is that order by not shorting right , although i triyed everything..

what could be the problem ? and is there any solutions?
May 22 '08 #1
Share this Question
Share on Google+
3 Replies


deepuv04
Expert 100+
P: 227
i have a problem in a query like


select field1, field2
from table1
order by field1 field1 contains countries (varchar2)


the problem is that order by not shorting right , although i triyed everything..

what could be the problem ? and is there any solutions?
hi,
if you want to get values in some order then simply use the following query
select field1, field2 from table1 order by field1

if you want to get the values on some condition use where clause
select field1, field2 from table1 where your_condition order by field1

for more details on "Contains" visit the following link, where you can see some examples

http://msdn.microsoft.com/en-us/library/ms187787.aspx
May 22 '08 #2

ck9663
Expert 2.5K+
P: 2,878
i have a problem in a query like


select field1, field2
from table1
order by field1 field1 contains countries (varchar2)


the problem is that order by not shorting right , although i triyed everything..

what could be the problem ? and is there any solutions?
Could you post some sample data on your table1 and how you would want it sorted? Since your countries are just varchar(2), I am assuming it's a code of some sort. If you need it sorted by name, you might need to join it with the table with the country name on it.

-- CK
May 22 '08 #3

Delerna
Expert 100+
P: 1,134
i have a problem in a query like


select field1, field2
from table1
order by field1 field1 contains countries (varchar2)


the problem is that order by not shorting right , although i triyed everything..

what could be the problem ? and is there any solutions?
also, be aware that text always sorts correctly for text (ascii values) but it dosn't always sort as we humans expect it to.
May 22 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.