Is it possible to use an order by statement but force mysql to start with a different entry than the first one?
eg. column is "class", which has the possible values "8maths", "10maths", "admaths", "methods", "spec". When I do an order by class statement, it does fine except obviously it starts with "10maths". But I need it to start with "8maths". Changing the value "8maths" to "08maths" is not an option, due to other constraints.
Is there a way to do this?
Thanks.
3 5344
If those are the only allowed values, you can use the FIELD attribute in the ORDER BY. For these 5 values that would be: - SELECT * FROM table
-
ORDER BY FIELD(LEFT(column,2),'8m','10','ad','me','es');
Ronald :cool:
Ronald. Many thanks. I appreciate incredibly you answering this...
Cheers.
Ronald. Many thanks. I appreciate incredibly you answering this...
Cheers.
That's what we are here for!
Ronald :cool:
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Yasaswi Pulavarti |
last post by:
Is it possible to order by specific values in a column. For example a
column may contain values like N, N1, N2, S, S1, S2, R, T. I want to
order by in such a way that all the records with N, N1, or...
|
by: Yannick Turgeon |
last post by:
Hello all,
I'm using SS2K on W2k.
I'v got a table say, humm, "Orders" with two fields in the PK:
OrderDate and CustomerID. I would like to add an "ID" column which
would be auto-increment...
|
by: der |
last post by:
Hello all,
I've a question about order of evaluations in expressions that have && and
|| operators in them.
The question is: will the evalution go left-to-right, no matter what -- even
if the...
|
by: Steve Jorgensen |
last post by:
Hi all,
Frankly, this is such an off-beat thing, I don't know if anyone else here will
ever have the same issue. Just in case anyone does, though...
I needed to be able to search for the...
|
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?
...
|
by: bevanward |
last post by:
Hi All
I am finding unexpected results when inserted into a newly created
table that has a field of datatype int identity (1,1).
Basically the order I sort on when inserting into the table is...
|
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...
|
by: nachch |
last post by:
Does the C specification define the order of evaluation of assignment
statements?
For example, what should be the output from the following:
int foo1() { printf("foo1\n"); return 0; }
int...
|
by: aRTx |
last post by:
<?
/*
Directory Listing Script - Version 2
====================================
Script Author: Artani <artan_p@msn.com>. www.artxcenter.com
REQUIREMENTS
============
This script requires...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM).
In this month's session, the creator of the excellent VBE...
|
by: MeoLessi9 |
last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
| |