Solved

sql in vb

Posted on 2004-04-30
7
118 Views
Last Modified: 2010-04-17
I have a 7 field position value and I need to have it sort by the the 5 and 6 character. how can I do this



ex

W123434
F1234336
B123434
h821313
j1234336


would look like this now

W123434
B123434
F1234336
j1234336
h821313

this is in visual basic 6
.


0
Comment
Question by:bear23
  • 3
7 Comments
 

Author Comment

by:bear23
ID: 10959607
also I will not know if the number or character is, just find the ones that match and put together


0
 
LVL 43

Accepted Solution

by:
TimCottee earned 25 total points
ID: 10959621
Hi bear23,

Select MyField From MyTable Order By Substring(MyField,5,2) ' for mssql
Select MyField From MyTable Order By Mid(MyField,5,2) ' for ms access

Tim Cottee
Brainbench MVP for Visual Basic
http://www.brainbench.com
0
 

Author Comment

by:bear23
ID: 10959806
what does the 5 represent


W123434

the first 4 in the above example

and the 2 meaning

43

???
0
 

Author Comment

by:bear23
ID: 10960096
let me give you another example


w123423
g3432c4
j2132a2
r123425
p3432a4
i1232c4


would look like
w123423     matched by 42
r123425      matched by 42
g3432c4      matched by 2c
i1232c4      matched by 2c
j2132a2     matched by 2a
p3432a4    matched by 2a


0
 
LVL 6

Expert Comment

by:PreachDotNet
ID: 10960374
Mid(MyField,5,2) Means select the centre of the field (MyField) begin at position 5, for a length of 2 ---
Mid(String,StartPosition,Length)
Don't want any points, Tim answered the question
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now