473,406 Members | 2,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Need Query Help.. Urgent....

hi..

i have query like this..

select id,name from tbl where id in(5,2,4,1,3);

When i execute the above query.. i get the result set with ascending order by id
by default. But i need the output without order by.
i need the order by valuewhatever in the IN condition.

Expecting Output:

id ---- Name
----------------
5------- xxx
2------- yyy
4------- zzz
1------ aaa
3----- bbbb


Can u any one solve this problem?

Thanks & Regards,
S.Ashokkumar.
Mar 3 '07 #1
1 1193
ronverdonk
4,258 Expert 4TB
hi..

i have query like this..

select id,name from tbl where id in(5,2,4,1,3);

When i execute the above query.. i get the result set with ascending order by id
by default. But i need the output without order by.
i need the order by valuewhatever in the IN condition.

Expecting Output:

id ---- Name
----------------
5------- xxx
2------- yyy
4------- zzz
1------ aaa
3----- bbbb

Can u any one solve this problem?

Thanks & Regards,
S.Ashokkumar.
You cannot get it without using the ORDER BY clause. The following will give it to you in the defined order
Expand|Select|Wrap|Line Numbers
  1. SELECT id,name FROM tbl 
  2.    WHERE id IN(5,2,4,1,3) 
  3.    ORDER BY FIELD(id,5,2,4,1,3);
Ronald :cool:
Mar 5 '07 #2

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

Similar topics

1
by: AVL | last post by:
Hi I'm working on indexing a website. I want to restict the search to only few file types like .doc,.txt and.ppt How to specify the file types in the 'ixsso.Query' object Presently i'n using...
3
by: JHNielson | last post by:
I AM AT THE WIRE AND DESPERATELY NEED SOME HELP! I have a query that checks that when the user submits data to me, it checks that their total is correct. The SQL looks like this: UPDATE...
2
by: JHNielson | last post by:
I Know I've posted an Urgent message before. But I'm in the middle of system testing, and these little stupid bugs are killing me...... I have a query that checks that a set of values (the...
0
by: Balamurugan Ranganathan | last post by:
I want to calculate the execution time of a sql query through C#.net this is to analysis two queries to compare their execution time it is very Urgent Please help me Please help Me ...
1
by: write2ashokkumar | last post by:
hi... i have the table like this, Table Name : sample Total Records : 500000 (Consider like this) Sample Records: id ------------ name
6
by: martin DH | last post by:
**Urgent Need** I'll throw out the basics and any assistance is very, very, very much appreciated! Access 2003 on XP On a form (frmMain) is an option group of check boxes (ReportFrame) from...
2
by: mirzaali | last post by:
Hi All, I neeed to dispaly the data in html table tag Query :-select comp,total,funds from table1, WHICH WIL RETURN 3-RECORDSETS rs_query(0) rs_query(1) rs_query(2)
1
by: veerunrt | last post by:
Hi All, one column is having no of values separated by comma in the table that any one value should match with some other column of another table one value how to join in oracle I need result...
5
by: Justin | last post by:
Here's my XML: <?xml version="1.0" ?> <AppMode Type="Network"> <CurrentFolder Path="c:\tabs"> <Tabs> <FilePath>tabs\Justin.tab</FilePath> <FilePath>tabs\Julie.tab</FilePath> *****There could...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.