Jump to content

Check If Field Is Numeric In Where Clause?


jgingras
 Share

Recommended Posts

How would I go about checking if a field value is numeric in the where clause of a mysql statement? The actual field is varchar but it is used to input transaction numbers which could include letters as well as numbers. One specific type of transaction, a Check, allows for a regular numeric check number as well as letters. Im trying to query that table to find only the check numbers that are completely numeric to be able to figure out what the next check will be.

 

How would I form the where statement?

 

Here is what I would think it would look like, except of course for the CheckNumber IS NUMERIC part.. but I want to get the higher check number already used.

 

SELECT CheckNumber FROM tblBankLedger WHERE (CheckNumber IS NUMERIC) ORDER BY CheckNumber DESC LIMIT 0,1

 

Thanks!

-Jacques

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...