473,383 Members | 1,877 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,383 software developers and data experts.

Order By statement

Is it possible to specify the sequence of the returned rows? I have
four incident types('IN', 'UN', 'SU', 'OT'). If I do an order by they
will be returned in that sequence. However the report calls for
returning them with 'OT' type last. This is being used in ColdFusion
4.5 with DB2 V7. Any ideas?
Nov 12 '05 #1
2 3329
"Mauricio" <ta****@yahoo.com> wrote in message
news:58**************************@posting.google.c om...
Is it possible to specify the sequence of the returned rows? I have
four incident types('IN', 'UN', 'SU', 'OT'). If I do an order by they
will be returned in that sequence. However the report calls for
returning them with 'OT' type last. This is being used in ColdFusion
4.5 with DB2 V7. Any ideas?


Use a CASE statement to create a new column in the select list that has the
sort sequence, and order by that column.
Nov 12 '05 #2
Hi Mauricio,
Try using the CASE stmt in the Order By clause.
something like:
Order By (CASE when col='OT' then 2 else 1 END)
HTH,
Aakash

"Mauricio" <ta****@yahoo.com> wrote in message
news:58**************************@posting.google.c om...
Is it possible to specify the sequence of the returned rows? I have
four incident types('IN', 'UN', 'SU', 'OT'). If I do an order by they
will be returned in that sequence. However the report calls for
returning them with 'OT' type last. This is being used in ColdFusion
4.5 with DB2 V7. Any ideas?

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Rick Snagglehimer | last post by:
I keep getting an error from the following SP snippet "Line 11: Incorrect syntax near 'BY'." It runs fine without the ORDER BY clause. >>>>>>>>>>>>>>> WHERE .clientID = .userID
7
by: Alex Vorobiev | last post by:
hi there, i am using sql server 7. below is the stored procedure that is giving me grief. its purpose it two-fold, depending on how it is called: either to return a pageset (based on page...
18
by: war_wheelan | last post by:
I am very new to Transact-SQL programming and don't have a programming background and was hoping that someone could point me in the right direction. I have a SELECT statement SELECT FIXID,...
1
by: Jeff Blee | last post by:
I hope someone can help me get this graph outputing in proper order. After help from Tom, I got a graph to display output from the previous 12 months and include the average of that output all in...
16
by: mdh | last post by:
May I ask the group the following: (Again, alas , from K&R) This is part of a function: while ( ( array1 = array2 ) != '\0' ); /* etc etc */ Is this the order that this is evaluated? ...
2
by: rdemyan via AccessMonster.com | last post by:
I can't seem to get the following SQL statement with the ORDER BY clause to work. It does work if I order by any of the fields in the SELECT part of the statement but not if it is the field in the...
3
by: Beowulf | last post by:
I was just messing around with some ad hoc views and table returning UDFs today so I could look at and print out data from a small table and noticed something strange. If I stick my select...
6
by: InnoCreate | last post by:
Hi everyone. I've recently written a classic asp website which uses an MS Access datasource. I know this is less than an ideal data source as it has limited functionality. I have a search form on...
3
by: =?Utf-8?B?VmFuZXNzYQ==?= | last post by:
Here is my loop and it runs fine: ---------------------------------------------------- sSQL = "SELECT * FROM STORE_ITEMS" Set DataRec = DB.execute(sSQL) if not DataRec.EOF then do while not...
3
by: ylekot88 | last post by:
Hi I am a student, I am trying to figure this out. I am trying to run a select statement that is asking for customer#, date, and total price of each order. ensure results are in chronological...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.