Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
| Search | Today's Posts | Mark Forums Read
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 12th, 2005, 12:09 AM
Registered User
 
Join Date: Apr 2005
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQL "Order By" problem

I have an Access database with one table that contains a number of fields. I use the database with Visual Basic 6.0. One of the fields (CustNumber) contains a sequence that I need to show up in a specific sorted order, but a simple "Order By" doesn't work for me. The data in that field consists of one of two combinations. It will be either a "N" + a "number" OR a "N" + a "number" & a "B" + a "number"; such as N14 OR N3B12.

The first example is what I have, the second example is what I get after my Select statement and the third example is what I need to really end up with. Any help would be appreciated.

My Select statement is:
Select * From TABLE Order By CustNumber

Example 1. Starting data ----->
CustNumber
  N1
  N21B7
  N4B1
  N31B81
  N4B5
  N4
  N21
  N31
  N31B6
  N50
Example 2. After the "Order By"
  N1
  N4
  N21
  N31
  N50
  N4B1
  N4B5
  N21B7
  N31B6

 
Old April 12th, 2005, 12:18 AM
Registered User
 
Join Date: Apr 2005
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Disregard this post - the full post is listed right after this one. Sorry, my internet connection took a hit as I was typing.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Using ORDER BY in SQL on date field in ASP page saifi4u Classic ASP Professional 3 March 1st, 2008 07:40 PM
Using ORDER BY in SQL query in ASP page saifi4u Classic ASP Databases 1 February 29th, 2008 09:19 AM
SQL "Order By" problem bear88 SQL Language 3 April 13th, 2005 10:45 AM
Desc order problem dssachdeva Oracle 0 September 17th, 2003 04:42 AM
ASP SQL fields in order ALoPresto Classic ASP Databases 2 July 25th, 2003 02:54 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.