473,397 Members | 2,099 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,397 software developers and data experts.

Remove numbers from field in ORDER BY

303 Expert 100+
I have a table (books) with 2 columns (book_id, book).
The table looks like:
[HTML]19 Psalms
20 Proverbs
60 1 Peter
61 2 Peter[/HTML]
I want to sort this by text first, then number if a book has a number. So the sorted data would look like:
[HTML]60 1 Peter
61 2 Peter
20 Proverbs
19 Psalms[/HTML]
My query is
Expand|Select|Wrap|Line Numbers
  1. SELECT book
  2. FROM books
  3. ORDER BY trim(replace(replace(replace(book,'3',''),'2',''),'1','')), book
This works, but isn't there a better way?
Oct 2 '08 #1
3 1881
improvcornartist
303 Expert 100+
My problem with this query is that replace is a VBA function, so it doesn't work when I try the query outside Access. Is there another way to do this?
Oct 2 '08 #2
missinglinq
3,532 Expert 2GB
"My problem with this query is that replace is a VBA function, so it doesn't work when I try the query outside Access. Is there another way to do this??"

Where exactly are you trying the query "outside of Access?"

Linq ;0)>
Oct 2 '08 #3
improvcornartist
303 Expert 100+
Sorry I didn't specify. I'm trying to use VBScript. Even within Access, I would like to find any better way to sort the data.
Oct 2 '08 #4

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

Similar topics

5
by: Merlin | last post by:
Hello all! I'll make it short and sweet... I have a database, it looks something like this: id data --- ------------------------- 0 Some Data 1...
7
by: pj | last post by:
Why does M$ Query Analyzer display all numbers as positive, no matter whether they are truly positive or negative ? I am having to cast each column to varchar to find out if there are any...
6
by: Rimuen | last post by:
Have a string contains numbers from database. But there is similar numbers want to remove Example: 1,3,6,6,6,12,13,14,15,15,15,15 Want to remove the similar numbers so it would be like:...
4
by: Bob Bryan | last post by:
I am using a select statement to obtain a result set back with aggregated data. The problem is that I am seeing column data with 11 to 13 digits after the decimal point. I tried using the STR...
16
by: StenKoll | last post by:
Help needed in order to create a register of stocks in a company. In accordance with local laws I need to give each individual share a number. I have accomplished this by establishing three tables...
7
by: Ariel | last post by:
I have a question that I'm hoping someone here can answer. Let's say I have two fields which have a beginning number and an ending number. What I'd like to do is have Access generate a list of...
12
by: Andrew Lias | last post by:
I've been given a task that I believe is, basically, impossible, but I'd like to see if there's a way to do it. What my boss wants me to do is to create a view, in SQL Server 2000, that will...
3
by: Danny Yeadon | last post by:
Hi I need to remove unwanted characters from phone numbers from my phone bill to analyse the data. Some examples are 02 48222222 i need to remove the space +61266667656 ...
5
by: JJM0926 | last post by:
I need some help with sorting some part numbers that are alphanumeric. I have a table with a part number field which are in the following format--sw1000, sw1200, sw2000, sw2600, sw3000, sw21000,...
8
by: clarencelai | last post by:
Hi.. I need to query a TEXT field in an ODBC table (Oracle) that contained numbers. 1) How can I sort those numbers in numeric order? Currently, number 1 ~ 11 is sorted in this order.. 1, 10,...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.