I have a query in which I would like the items to be returned in a certain order, starting with those having value:
ID_ObservationType=1 and then 3 and then 2.
I used to order it 1,2,3 but now the client has asked for them items to come in a different fashion. Is there a simple way to request this via SQL, so I don't have to write some fancy to solve it.
On second thougts, simpler would be
NewSort:iif(ID_ObservationType=2,20,ID_Observation Type)
3 1792
As a "Quick Fix" you could try adding a calculated field to the query
NewSort:iif(ID_ObservationType=1,1,iif(ID_Observat ionType=3,2,3))
and then sorting by that instead
Something along those lines
There is always someone who mucks up your carefully planned database :)
On second thougts, simpler would be
NewSort:iif(ID_ObservationType=2,20,ID_Observation Type)
Is IIF native SQL (I dont think it is). I would prefer to keep it in native sql if possible, for performance issues. But for now, I will go with your solution Delerna, thank you!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: its me |
last post by:
Let's say I have a class of people...
Public Class People
Public Sex as String
Public Age as int
Public Name as string
end class
And I declare an array of this class...
|
by: Xah Lee |
last post by:
Sort a List
Xah Lee, 200510
In this page, we show how to sort a list in Python & Perl and also
discuss some math of sort.
To sort a list in Python, use the “sort” method. For example:
...
|
by: Steve Crawford |
last post by:
I am suffering some sort order confusion. Given a database, "foo",
with a single character(4) column of data left padded with spaces I
get:
select * from foo order by somechars;
somechars...
|
by: adrian.chandler |
last post by:
Hi all,
I have been using letter and symbol codes such as GNU< GNU\ GNU}
GNU in an Access table. I was surprised to see that when the table
was sorted on this field, the order is:
GNU...
|
by: Jan Smith |
last post by:
I've searched the overloads for the Array.Sort method, and I haven't found a
clear answer to my question. Maybe it's not in Array.Sort.
Here's the question:
I initialize an array X with the...
|
by: Patrick |
last post by:
I got a page that loads a xml file into a treeview control. I want it to
sort the data before sending it to the treeview control is that possible?
<root>
<level1 name="" src="" order="0">...
|
by: weetat.yeo |
last post by:
Hi all ,
I have sql statement below ,
SELECT
serial_no,host_name,chasis_model,chasis_flash_size,chasis_dram_size,...
|
by: wheel |
last post by:
I have already built in support for multiple languages in some of my
applications, but so far they have only used Western languages (English,
Spanish, etc). I need to add some Far East languages:...
|
by: Kc-Mass |
last post by:
In a standard Ascii table a dash or hyphen is decimal 45. A period or dot is
decimal 46.
If I sort a table or recordset of mixed character string ascending in
Access, those strings beginning with...
|
by: KevinADC |
last post by:
Purpose
The purpose of this article is to discuss the difference between characters inside a character class and outside a character class and some special characters inside a character class....
|
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...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
| | |