Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8125503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:50:28+00:00 2026-06-06T06:50:28+00:00

Below is what I have in table myTable +++++++++++++++ + id + myWord +

  • 0

Below is what I have in table myTable

+++++++++++++++
+ id + myWord +
+++++++++++++++
+  1 + AB123  +
+  2 + A413D  +
+  3 + X5231  +
+  4 + ABE921 +
+++++++++++++++

When I execute

SELECT id, Locate('1',myWord) as myPos
FROM myTable;

I get position of 1.

+++++++++++++++
+ id + myPos  +
+++++++++++++++
+  1 + 3      +
+  2 + 3      +
+  3 + 5      +
+  4 + 6      +
+++++++++++++++

What I want to achieve is finding first position of integer so that I will have below output.

+++++++++++++++++++++++
+ id + myWord + myPos +
+++++++++++++++++++++++
+  1 + AB123  +  3    +
+  2 + A413D  +  2    +
+  3 + X5231  +  2    +
+  4 + ABE921 +  4    +
+++++++++++++++++++++++

Any Idea how I can achieve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T06:50:30+00:00Added an answer on June 6, 2026 at 6:50 am

    With help of xdazz answer, I did some changes and got answer finally…

    SELECT 
      myWord, 
      LEAST (
        if (Locate('0',myWord) >0,Locate('0',myWord),999),
        if (Locate('1',myWord) >0,Locate('1',myWord),999),
        if (Locate('2',myWord) >0,Locate('2',myWord),999),
        if (Locate('3',myWord) >0,Locate('3',myWord),999),
        if (Locate('4',myWord) >0,Locate('4',myWord),999),
        if (Locate('5',myWord) >0,Locate('5',myWord),999),
        if (Locate('6',myWord) >0,Locate('6',myWord),999),
        if (Locate('7',myWord) >0,Locate('7',myWord),999),
        if (Locate('8',myWord) >0,Locate('8',myWord),999),
        if (Locate('9',myWord) >0,Locate('9',myWord),999)
      ) as myPos
    FROM myTable;
    

    Demo

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created table and inserted values as below. create table mytable (id INT,
I have the below table. I am trying to get tbody column bgcolors matching
Suppose I have a table MYtable as given below: ID A B C 1
I have a table as below; <table id=mytable cellpadding=0 cellspacing=0> <tr> <td>&nbsp;</td> <td><input type=text
I have a table as below; <table id=mytable> <tr> <td>cola1</td> <td>cola2</td> <td>cola3</td> <td class=rem>cola4</td>
I have a table like below <table id=mytable> <tr><th>checked</th><th>id</th><th>text</th></tr> <tr><td><input id=cb1 type=checkbox name=checker1/></td><td>123</td><td>abc</td></tr> <tr><td><input
Below is what I have in my table. myTable ++++++++++++++++++++ Parent + Child ++++++++++++++++++++
I have a table like below: MyTable -------- A B C A,B,C are columns
How do I select in a table like below all objects that have a-A
Below is what I have in table myTable . +--------+--------+--------+--------+ | value1 | value2

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.