473,738 Members | 2,009 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

select using LIKE where first character is a integer

hi,

i have some data in mysql in a column like this:
6.1.01 Financial Regulations
3.32.02 Academic Counseling

what iam selecting is select by letter A, B, C...Z. so my first char in
the column is always a integer, how can i select when the first few
characters are always a integer, i want to get rid of the integers and
run query on the word when selecting.

would greatly appreciate someone's help on this

Jul 3 '06 #1
2 9173

<co******@gmail .comwrote in message
news:11******** **************@ m73g2000cwd.goo glegroups.com.. .
hi,

i have some data in mysql in a column like this:
6.1.01 Financial Regulations
3.32.02 Academic Counseling

what iam selecting is select by letter A, B, C...Z. so my first char in
the column is always a integer, how can i select when the first few
characters are always a integer, i want to get rid of the integers and
run query on the word when selecting.

would greatly appreciate someone's help on this
Given these circumstances, it would probably be smarter to match on a more
complete string rather than just the first letter. You could use:
{fld} LIKE '%Financial %'
or
{fld} LIKE '%Academic %"

and this would get you past caring about the irregular leading numeric
digits.
OR
you might take advantage of the fact that the string you are looking for
begins just after the blank space " " that follows the number.

WHERE MID({fld}, LOCATE(' ', {fld})+1, 1) = 'A'

LOCATE() finds the first blank space and MID() shows you the string starting
with the first alpahabetic character that follows.

I like the first solution because it identifies the string more explicitly.
Thomas Bartkus
Jul 5 '06 #2
pinguinu
3 New Member
hy
try this

select * from barcode
where (SUBSTR(barcode , 1, 1) not between '0' and '9')
or (SUBSTR(barcode , 2, 1) not between '0' and '9')
or (SUBSTR(barcode , 3, 1) not between '0' and '9')
Jul 6 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1983
by: Gary | last post by:
Morning all, I have a form field called: Bsk01 How do I onBlur prompt the user to enter a ZERO as character one, if one is not already entered. At the same time, I would like to ensure at least 5t characters have been entered. This validation should also only trigger if anything is entered. Basically, if the user chooses to enter nothing then the check should not be carried out and the user should be able to continue.
8
7638
by: Mr. B | last post by:
In VB6, I had some code which 'forced' the first character of a string entered to be Capital. For example, if a person was entering their name (john doe)... the code would 'force' --- John Doe. Here is what I believe is the VB6 code: Private Sub txbModUser_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txbModUser.TextChanged KeyAscii = AutoType(Screen.ActiveControl, KeyAscii) End Sub
2
1448
by: Greg Buckley | last post by:
I have come across an interesting problem. Let me first state that I am not a fluent ASP programmer. I am a network engineering trying to port an existing app. The app in question is currently running on IIS 5.0 (2Kserver) in a NT 4.0 domain. I am moving it to an IIS 6.0 server in a 2003 Active Directory domain. My app calls this variable <%= varUser %> and brings the users login name to the web page as well as using it to pull data...
0
3146
by: jtocci | last post by:
I'm having a big problem with CREATE RULE...ON INSERT...INSERT INTO...SELECT...FROM...WHERE when I want to INSERT several (20~50) records based on a single INSERT to a view. Either I get a 'too much data for field' or the query just runs on and on til I have to restart the postmaster. I have found rules to compare mine to but people limit the resulting insert to one record (the WHERE generally limits the result of the SELECT to one...
2
2071
by: D.Frangiskatos | last post by:
Hi, I have been working for a few months in project that deals raw sockets. However recently, and while trying to examine the contents of the buffer used in recvfrom i was a bit confused. The buffer was allocated using malloc as it can be seen next: do { ..............
2
1572
by: bmayer | last post by:
I am using a SqlDataSource to put data into a database from three TextBoxes. The problem is that only the first character from the TextBoxes is being inserted into the database. The code: <InsertParameters> <asp:ControlParameter ControlID="TextBox2" Name="Text1"
9
7987
by: sovht | last post by:
System: Intel, Windows XP Pro, SP2 IDE: VC++ 6.0 Problem: *Very* simple program to create a MessageBox only ever displays the first character of the given string. I checked the spec for the MessageBox function and I believe I am adhering to it. I have also done a search for this issue, but have come up empty handed. Perhaps my search parameters were at fault ... #include <windows.h> // added to make MessageBox work (esp w/MB_<code>s)...
3
1607
bartonc
by: bartonc | last post by:
Is it possible to select a column of type INTEGER PRIMARY KEY without knowing its name? This also happens to be column zero in all my tables. I've played with lots of different syntaxes, to no avail. I was hoping for something compatible with SQLite like:SELECT * FROM tablename WHERE ROWID = n; # or SELECT * FROM tablename WHERE _ROWID_ = n; # or SELECT * FROM tablename WHERE OID = n;Thanks, all.
1
1750
by: Pheddy | last post by:
Hey everybody! I need a code to select all (*) from my databse (.mdb - microsoft access) where first letter i X.. how can I do this? Thanks. Frederik
0
8787
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9473
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9208
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8208
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6750
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6053
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4569
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4824
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.